Mercurial > vim
diff src/spell.c @ 13380:69517d67421f v8.0.1564
patch 8.0.1564: too many #ifdefs
commit https://github.com/vim/vim/commit/f2bd8ef2b4507d02c6043affff8f7e85e3414d5f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 4 18:08:14 2018 +0100
patch 8.0.1564: too many #ifdefs
Problem: Too many #ifdefs.
Solution: Graduate the +autocmd feature. Takes away 450 #ifdefs and
increases code size of tiny Vim by only 40 Kbyte.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 04 Mar 2018 18:15:08 +0100 |
parents | ae312df8d0ab |
children | 27b9a84395b5 |
line wrap: on
line diff
--- a/src/spell.c +++ b/src/spell.c @@ -1849,9 +1849,7 @@ spell_load_lang(char_u *lang) char_u fname_enc[85]; int r; spelload_T sl; -#ifdef FEAT_AUTOCMD int round; -#endif /* Copy the language name to pass it to spell_load_cb() as a cookie. * It's truncated when an error is detected. */ @@ -1859,11 +1857,9 @@ spell_load_lang(char_u *lang) sl.sl_slang = NULL; sl.sl_nobreak = FALSE; -#ifdef FEAT_AUTOCMD /* We may retry when no spell file is found for the language, an * autocommand may load it then. */ for (round = 1; round <= 2; ++round) -#endif { /* * Find the first spell file for "lang" in 'runtimepath' and load it. @@ -1889,17 +1885,13 @@ spell_load_lang(char_u *lang) lang); r = do_in_runtimepath(fname_enc, 0, spell_load_cb, &sl); -#ifdef FEAT_AUTOCMD if (r == FAIL && *sl.sl_lang != NUL && round == 1 && apply_autocmds(EVENT_SPELLFILEMISSING, lang, curbuf->b_fname, FALSE, curbuf)) continue; break; -#endif - } -#ifdef FEAT_AUTOCMD + } break; -#endif } if (r == FAIL) @@ -2348,11 +2340,9 @@ did_set_spelllang(win_T *wp) static int recursive = FALSE; char_u *ret_msg = NULL; char_u *spl_copy; -#ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, wp->w_buffer); -#endif /* We don't want to do this recursively. May happen when a language is * not available and the SpellFileMissing autocommand opens a new buffer @@ -2449,7 +2439,6 @@ did_set_spelllang(win_T *wp) else { spell_load_lang(lang); -#ifdef FEAT_AUTOCMD /* SpellFileMissing autocommands may do anything, including * destroying the buffer we are using... */ if (!bufref_valid(&bufref)) @@ -2457,7 +2446,6 @@ did_set_spelllang(win_T *wp) ret_msg = (char_u *)N_("E797: SpellFileMissing autocommand deleted buffer"); goto theend; } -#endif } }