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.
diff --git a/src/mbyte.c b/src/mbyte.c
index 9b788b0..cb2d2d9 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -799,11 +799,9 @@
fix_arg_enc();
#endif
-#ifdef FEAT_AUTOCMD
/* Fire an autocommand to let people do custom font setup. This must be
* after Vim has been setup for the new encoding. */
apply_autocmds(EVENT_ENCODINGCHANGED, NULL, (char_u *)"", FALSE, curbuf);
-#endif
#ifdef FEAT_SPELL
/* Need to reload spell dictionaries */
@@ -4792,7 +4790,8 @@
# define USE_IMSTATUSFUNC (*p_imsf != NUL)
#endif
-#if defined(FEAT_EVAL) && defined(FEAT_MBYTE)
+#if defined(FEAT_EVAL) && defined(FEAT_MBYTE) \
+ && (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM))
static void
call_imactivatefunc(int active)
{
@@ -4811,11 +4810,7 @@
int is_active;
/* FIXME: Don't execute user function in unsafe situation. */
- if (exiting
-# ifdef FEAT_AUTOCMD
- || is_autocmd_blocked()
-# endif
- )
+ if (exiting || is_autocmd_blocked())
return FALSE;
/* FIXME: :py print 'xxx' is shown duplicate result.
* Use silent to avoid it. */
@@ -5698,11 +5693,11 @@
void
xim_reset(void)
{
-#ifdef FEAT_EVAL
+# ifdef FEAT_EVAL
if (USE_IMACTIVATEFUNC)
call_imactivatefunc(im_is_active);
else
-#endif
+# endif
if (xic != NULL)
{
gtk_im_context_reset(xic);
@@ -6482,11 +6477,11 @@
#else /* !defined(FEAT_XIM) */
-# if !defined(FEAT_GUI_W32) || !(defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))
+# ifdef IME_WITHOUT_XIM
static int im_was_set_active = FALSE;
int
-im_get_status()
+im_get_status(void)
{
# if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
if (USE_IMSTATUSFUNC)