Karsten Hopp 2594a4
To: vim_dev@googlegroups.com
Karsten Hopp 2594a4
Subject: Patch 7.3.438
Karsten Hopp 2594a4
Fcc: outbox
Karsten Hopp 2594a4
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 2594a4
Mime-Version: 1.0
Karsten Hopp 2594a4
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 2594a4
Content-Transfer-Encoding: 8bit
Karsten Hopp 2594a4
------------
Karsten Hopp 2594a4
Karsten Hopp 2594a4
Patch 7.3.438
Karsten Hopp 2594a4
Problem:    There is no way to avoid ":doautoall" reading modelines.
Karsten Hopp 2594a4
Solution:   Add the <nomodeline> argument. Adjust documentation.
Karsten Hopp 2594a4
Files:	    src/fileio.c, runtime/doc/autocmd.txt
Karsten Hopp 2594a4
Karsten Hopp 2594a4
Karsten Hopp 2594a4
*** ../vim-7.3.437/src/fileio.c	2012-02-11 23:45:30.000000000 +0100
Karsten Hopp 2594a4
--- src/fileio.c	2012-02-12 00:08:17.000000000 +0100
Karsten Hopp 2594a4
***************
Karsten Hopp 2594a4
*** 8739,8744 ****
Karsten Hopp 2594a4
--- 8739,8752 ----
Karsten Hopp 2594a4
      int		retval;
Karsten Hopp 2594a4
      aco_save_T	aco;
Karsten Hopp 2594a4
      buf_T	*buf;
Karsten Hopp 2594a4
+     char_u	*arg = eap->arg;
Karsten Hopp 2594a4
+     int		call_do_modelines = TRUE;
Karsten Hopp 2594a4
+ 
Karsten Hopp 2594a4
+     if (STRNCMP(arg, "<nomodeline>", 12) == 0)
Karsten Hopp 2594a4
+     {
Karsten Hopp 2594a4
+ 	call_do_modelines = FALSE;
Karsten Hopp 2594a4
+ 	arg = skipwhite(arg + 12);
Karsten Hopp 2594a4
+     }
Karsten Hopp 2594a4
  
Karsten Hopp 2594a4
      /*
Karsten Hopp 2594a4
       * This is a bit tricky: For some commands curwin->w_buffer needs to be
Karsten Hopp 2594a4
***************
Karsten Hopp 2594a4
*** 8755,8765 ****
Karsten Hopp 2594a4
  	    aucmd_prepbuf(&aco, buf);
Karsten Hopp 2594a4
  
Karsten Hopp 2594a4
  	    /* execute the autocommands for this buffer */
Karsten Hopp 2594a4
! 	    retval = do_doautocmd(eap->arg, FALSE);
Karsten Hopp 2594a4
  
Karsten Hopp 2594a4
! 	    /* Execute the modeline settings, but don't set window-local
Karsten Hopp 2594a4
! 	     * options if we are using the current window for another buffer. */
Karsten Hopp 2594a4
! 	    do_modelines(curwin == aucmd_win ? OPT_NOWIN : 0);
Karsten Hopp 2594a4
  
Karsten Hopp 2594a4
  	    /* restore the current window */
Karsten Hopp 2594a4
  	    aucmd_restbuf(&aco;;
Karsten Hopp 2594a4
--- 8763,8777 ----
Karsten Hopp 2594a4
  	    aucmd_prepbuf(&aco, buf);
Karsten Hopp 2594a4
  
Karsten Hopp 2594a4
  	    /* execute the autocommands for this buffer */
Karsten Hopp 2594a4
! 	    retval = do_doautocmd(arg, FALSE);
Karsten Hopp 2594a4
  
Karsten Hopp 2594a4
! 	    if (call_do_modelines)
Karsten Hopp 2594a4
! 	    {
Karsten Hopp 2594a4
! 		/* Execute the modeline settings, but don't set window-local
Karsten Hopp 2594a4
! 		 * options if we are using the current window for another
Karsten Hopp 2594a4
! 		 * buffer. */
Karsten Hopp 2594a4
! 		do_modelines(curwin == aucmd_win ? OPT_NOWIN : 0);
Karsten Hopp 2594a4
! 	    }
Karsten Hopp 2594a4
  
Karsten Hopp 2594a4
  	    /* restore the current window */
Karsten Hopp 2594a4
  	    aucmd_restbuf(&aco;;
Karsten Hopp 2594a4
*** ../vim-7.3.437/runtime/doc/autocmd.txt	2011-05-19 17:25:36.000000000 +0200
Karsten Hopp 2594a4
--- runtime/doc/autocmd.txt	2012-02-12 00:03:45.000000000 +0100
Karsten Hopp 2594a4
***************
Karsten Hopp 2594a4
*** 1065,1077 ****
Karsten Hopp 2594a4
  			autocommands for that group.  Note: if you use an
Karsten Hopp 2594a4
  			undefined group name, Vim gives you an error message.
Karsten Hopp 2594a4
  
Karsten Hopp 2594a4
- 			After applying the autocommands the modelines are
Karsten Hopp 2594a4
- 			processed, so that their settings overrule the
Karsten Hopp 2594a4
- 			settings from autocommands, like what happens when
Karsten Hopp 2594a4
- 			editing a file.
Karsten Hopp 2594a4
- 
Karsten Hopp 2594a4
  						*:doautoa* *:doautoall*
Karsten Hopp 2594a4
! :doautoa[ll] [group] {event} [fname]
Karsten Hopp 2594a4
  			Like ":doautocmd", but apply the autocommands to each
Karsten Hopp 2594a4
  			loaded buffer.  Note that [fname] is used to select
Karsten Hopp 2594a4
  			the autocommands, not the buffers to which they are
Karsten Hopp 2594a4
--- 1073,1080 ----
Karsten Hopp 2594a4
  			autocommands for that group.  Note: if you use an
Karsten Hopp 2594a4
  			undefined group name, Vim gives you an error message.
Karsten Hopp 2594a4
  
Karsten Hopp 2594a4
  						*:doautoa* *:doautoall*
Karsten Hopp 2594a4
! :doautoa[ll] [<nomodeline>] [group] {event} [fname]
Karsten Hopp 2594a4
  			Like ":doautocmd", but apply the autocommands to each
Karsten Hopp 2594a4
  			loaded buffer.  Note that [fname] is used to select
Karsten Hopp 2594a4
  			the autocommands, not the buffers to which they are
Karsten Hopp 2594a4
***************
Karsten Hopp 2594a4
*** 1082,1087 ****
Karsten Hopp 2594a4
--- 1085,1096 ----
Karsten Hopp 2594a4
  			This command is intended for autocommands that set
Karsten Hopp 2594a4
  			options, change highlighting, and things like that.
Karsten Hopp 2594a4
  
Karsten Hopp 2594a4
+ 			After applying the autocommands the modelines are
Karsten Hopp 2594a4
+ 			processed, so that their settings overrule the
Karsten Hopp 2594a4
+ 			settings from autocommands, like what happens when
Karsten Hopp 2594a4
+ 			editing a file. This is skipped when the <nomodeline>
Karsten Hopp 2594a4
+ 			argument is present.
Karsten Hopp 2594a4
+ 
Karsten Hopp 2594a4
  ==============================================================================
Karsten Hopp 2594a4
  10. Using autocommands					*autocmd-use*
Karsten Hopp 2594a4
  
Karsten Hopp 2594a4
*** ../vim-7.3.437/src/version.c	2012-02-11 23:45:30.000000000 +0100
Karsten Hopp 2594a4
--- src/version.c	2012-02-12 00:16:04.000000000 +0100
Karsten Hopp 2594a4
***************
Karsten Hopp 2594a4
*** 716,717 ****
Karsten Hopp 2594a4
--- 716,719 ----
Karsten Hopp 2594a4
  {   /* Add new patch number below this line */
Karsten Hopp 2594a4
+ /**/
Karsten Hopp 2594a4
+     438,
Karsten Hopp 2594a4
  /**/
Karsten Hopp 2594a4
Karsten Hopp 2594a4
-- 
Karsten Hopp 2594a4
"Oh, no!  NOT the Spanish Inquisition!"
Karsten Hopp 2594a4
"NOBODY expects the Spanish Inquisition!!!"
Karsten Hopp 2594a4
				-- Monty Python sketch --
Karsten Hopp 2594a4
"Oh, no!  NOT another option!"
Karsten Hopp 2594a4
"EVERYBODY expects another option!!!"
Karsten Hopp 2594a4
				-- Discussion in vim-dev mailing list --
Karsten Hopp 2594a4
Karsten Hopp 2594a4
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 2594a4
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 2594a4
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 2594a4
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///