diff src/fileio.c @ 3350:198ec1fff71a v7.3.442

updated for version 7.3.442 Problem: Still read modelines for ":doautocmd". Solution: Move check for <nomodeline> to separate function.
author Bram Moolenaar <bram@vim.org>
date Sun, 12 Feb 2012 20:14:01 +0100
parents bb67cd961fc3
children de60f6fa3d8d
line wrap: on
line diff
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -8740,13 +8740,7 @@ ex_doautoall(eap)
     aco_save_T	aco;
     buf_T	*buf;
     char_u	*arg = eap->arg;
-    int		call_do_modelines = TRUE;
-
-    if (STRNCMP(arg, "<nomodeline>", 12) == 0)
-    {
-	call_do_modelines = FALSE;
-	arg = skipwhite(arg + 12);
-    }
+    int		call_do_modelines = check_nomodeline(&arg);
 
     /*
      * This is a bit tricky: For some commands curwin->w_buffer needs to be
@@ -8786,6 +8780,23 @@ ex_doautoall(eap)
 }
 
 /*
+ * Check *argp for <nomodeline>.  When it is present return FALSE, otherwise
+ * return TRUE and advance *argp to after it.
+ * Thus return TRUE when do_modelines() should be called.
+ */
+    int
+check_nomodeline(argp)
+    char_u **argp;
+{
+    if (STRNCMP(*argp, "<nomodeline>", 12) == 0)
+    {
+	*argp = skipwhite(*argp + 12);
+	return FALSE;
+    }
+    return TRUE;
+}
+
+/*
  * Prepare for executing autocommands for (hidden) buffer "buf".
  * Search for a visible window containing the current buffer.  If there isn't
  * one then use "aucmd_win".