Karsten Hopp 22de73
# KH: Modified as it collides with the runtime-update patch
Karsten Hopp 22de73
Karsten Hopp 78e568
To: vim-dev@vim.org
Karsten Hopp 78e568
Subject: patch 7.0.187
Karsten Hopp 78e568
Fcc: outbox
Karsten Hopp 78e568
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 78e568
Mime-Version: 1.0
Karsten Hopp 78e568
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 78e568
Content-Transfer-Encoding: 8bit
Karsten Hopp 78e568
------------
Karsten Hopp 78e568
Karsten Hopp 78e568
Patch 7.0.187
Karsten Hopp 78e568
Problem:    Can't source a remote script properly.
Karsten Hopp 78e568
Solution:   Add the SourceCmd event. (Charles Campbell)
Karsten Hopp 78e568
Files:	    runtime/doc/autocmd.txt, src/ex_cmds2.c, src/fileio.c, src/vim.h
Karsten Hopp 78e568
Karsten Hopp 22de73
diff -urN runtime/doc/autocmd.txt runtime/doc/autocmd.txt.new
Karsten Hopp 22de73
--- runtime/doc/autocmd.txt	2006-09-08 17:26:31.000000000 -0400
Karsten Hopp 22de73
+++ runtime/doc/autocmd.txt	2007-01-23 06:17:46.000000000 -0500
Karsten Hopp 22de73
@@ -1,4 +1,4 @@
Karsten Hopp 22de73
-*autocmd.txt*   For Vim version 7.0.  Last change: 2006 Aug 29
Karsten Hopp 22de73
+*autocmd.txt*   For Vim version 7.0.  Last change: 2007 Jan 16
Karsten Hopp 22de73
 
Karsten Hopp 22de73
 
Karsten Hopp 22de73
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
Karsten Hopp 22de73
@@ -279,6 +279,7 @@
Karsten Hopp 22de73
 |FuncUndefined|		a user function is used but it isn't defined
Karsten Hopp 22de73
 |SpellFileMissing|	a spell file is used but it can't be found
Karsten Hopp 22de73
 |SourcePre|		before sourcing a Vim script
Karsten Hopp 22de73
+|SourceCmd|		before sourcing a Vim script |Cmd-event|
Karsten Hopp 22de73
 
Karsten Hopp 22de73
 |VimResized|		after the Vim window size changed
Karsten Hopp 22de73
 |FocusGained|		Vim got input focus
Karsten Hopp 22de73
@@ -695,10 +696,16 @@
Karsten Hopp 22de73
 							*SourcePre*
Karsten Hopp 22de73
 SourcePre			Before sourcing a Vim script. |:source|
Karsten Hopp 22de73
 				<afile> is the name of the file being sourced.
Karsten Hopp 22de73
+							*SourceCmd*
Karsten Hopp 22de73
+SourceCmd			When sourcing a Vim script. |:source|
Karsten Hopp 22de73
+				<afile> is the name of the file being sourced.
Karsten Hopp 22de73
+				The autocommand must source this file.
Karsten Hopp 22de73
+				|Cmd-event|
Karsten Hopp 22de73
 							*SpellFileMissing*
Karsten Hopp 22de73
 SpellFileMissing		When trying to load a spell checking file and
Karsten Hopp 22de73
-				it can't be found.  <amatch> is the language,
Karsten Hopp 22de73
-				'encoding' also matters.  See
Karsten Hopp 22de73
+				it can't be found.  The pattern is matched
Karsten Hopp 22de73
+				against the language.  <amatch> is the
Karsten Hopp 22de73
+				language, 'encoding' also matters.  See
Karsten Hopp 22de73
 				|spell-SpellFileMissing|.
Karsten Hopp 22de73
 							*StdinReadPost*
Karsten Hopp 22de73
 StdinReadPost			After reading from the stdin into the buffer,
Karsten Hopp 22de73
@@ -1224,8 +1231,8 @@
Karsten Hopp 22de73
 
Karsten Hopp 22de73
 							*Cmd-event*
Karsten Hopp 22de73
 When using one of the "*Cmd" events, the matching autocommands are expected to
Karsten Hopp 22de73
-do the file reading or writing.  This can be used when working with a special
Karsten Hopp 22de73
-kind of file, for example on a remote system.
Karsten Hopp 22de73
+do the file reading, writing or sourcing.  This can be used when working with
Karsten Hopp 22de73
+a special kind of file, for example on a remote system.
Karsten Hopp 22de73
 CAREFUL: If you use these events in a wrong way, it may have the effect of
Karsten Hopp 22de73
 making it impossible to read or write the matching files!  Make sure you test
Karsten Hopp 22de73
 your autocommands properly.  Best is to use a pattern that will never match a
Karsten Hopp 22de73
@@ -1238,9 +1245,10 @@
Karsten Hopp 22de73
 original file isn't needed for recovery.  You might want to do this only when
Karsten Hopp 22de73
 you expect the file to be modified.
Karsten Hopp 22de73
 
Karsten Hopp 22de73
-The |v:cmdarg| variable holds the "++enc=" and "++ff=" argument that are
Karsten Hopp 22de73
-effective.  These should be used for the command that reads/writes the file.
Karsten Hopp 22de73
-The |v:cmdbang| variable is one when "!" was used, zero otherwise.
Karsten Hopp 22de73
+For file read and write commands the |v:cmdarg| variable holds the "++enc="
Karsten Hopp 22de73
+and "++ff=" argument that are effective.  These should be used for the command
Karsten Hopp 22de73
+that reads/writes the file.  The |v:cmdbang| variable is one when "!" was
Karsten Hopp 22de73
+used, zero otherwise.
Karsten Hopp 22de73
 
Karsten Hopp 22de73
 See the $VIMRUNTIME/plugin/netrw.vim for examples.
Karsten Hopp 22de73
 
Karsten Hopp 78e568
*** ../vim-7.0.186/src/ex_cmds2.c	Tue Aug 29 17:28:56 2006
Karsten Hopp 78e568
--- src/ex_cmds2.c	Tue Jan 16 18:30:40 2007
Karsten Hopp 78e568
***************
Karsten Hopp 78e568
*** 2811,2816 ****
Karsten Hopp 78e568
--- 2811,2827 ----
Karsten Hopp 78e568
      }
Karsten Hopp 78e568
  
Karsten Hopp 78e568
  #ifdef FEAT_AUTOCMD
Karsten Hopp 78e568
+     /* Apply SourceCmd autocommands, they should get the file and source it. */
Karsten Hopp 78e568
+     if (has_autocmd(EVENT_SOURCECMD, fname_exp, NULL)
Karsten Hopp 78e568
+ 	    && apply_autocmds(EVENT_SOURCECMD, fname_exp, fname_exp,
Karsten Hopp 78e568
+ 							       FALSE, curbuf))
Karsten Hopp 78e568
+ # ifdef FEAT_EVAL
Karsten Hopp 78e568
+ 	return aborting() ? FAIL : OK;
Karsten Hopp 78e568
+ # else
Karsten Hopp 78e568
+ 	return OK;
Karsten Hopp 78e568
+ # endif
Karsten Hopp 78e568
+ 
Karsten Hopp 78e568
+     /* Apply SourcePre autocommands, they may get the file. */
Karsten Hopp 78e568
      apply_autocmds(EVENT_SOURCEPRE, fname_exp, fname_exp, FALSE, curbuf);
Karsten Hopp 78e568
  #endif
Karsten Hopp 78e568
  
Karsten Hopp 78e568
*** ../vim-7.0.186/src/fileio.c	Tue Jan  9 15:43:39 2007
Karsten Hopp 78e568
--- src/fileio.c	Tue Jan 16 18:23:35 2007
Karsten Hopp 78e568
***************
Karsten Hopp 78e568
*** 7019,7024 ****
Karsten Hopp 78e568
--- 7020,7026 ----
Karsten Hopp 78e568
      {"ShellCmdPost",	EVENT_SHELLCMDPOST},
Karsten Hopp 78e568
      {"ShellFilterPost",	EVENT_SHELLFILTERPOST},
Karsten Hopp 78e568
      {"SourcePre",	EVENT_SOURCEPRE},
Karsten Hopp 78e568
+     {"SourceCmd",	EVENT_SOURCECMD},
Karsten Hopp 78e568
      {"SpellFileMissing",EVENT_SPELLFILEMISSING},
Karsten Hopp 78e568
      {"StdinReadPost",	EVENT_STDINREADPOST},
Karsten Hopp 78e568
      {"StdinReadPre",	EVENT_STDINREADPRE},
Karsten Hopp 78e568
*** ../vim-7.0.186/src/vim.h	Wed Nov  1 15:31:02 2006
Karsten Hopp 78e568
--- src/vim.h	Tue Jan 16 18:22:28 2007
Karsten Hopp 78e568
***************
Karsten Hopp 78e568
*** 1102,1108 ****
Karsten Hopp 78e568
      EVENT_COLORSCHEME,		/* after loading a colorscheme */
Karsten Hopp 78e568
      EVENT_FILEAPPENDPOST,	/* after appending to a file */
Karsten Hopp 78e568
      EVENT_FILEAPPENDPRE,	/* before appending to a file */
Karsten Hopp 78e568
!     EVENT_FILEAPPENDCMD,	/* appende to a file using command */
Karsten Hopp 78e568
      EVENT_FILECHANGEDSHELL,	/* after shell command that changed file */
Karsten Hopp 78e568
      EVENT_FILECHANGEDSHELLPOST,	/* after (not) reloading changed file */
Karsten Hopp 78e568
      EVENT_FILECHANGEDRO,	/* before first change to read-only file */
Karsten Hopp 78e568
--- 1102,1108 ----
Karsten Hopp 78e568
      EVENT_COLORSCHEME,		/* after loading a colorscheme */
Karsten Hopp 78e568
      EVENT_FILEAPPENDPOST,	/* after appending to a file */
Karsten Hopp 78e568
      EVENT_FILEAPPENDPRE,	/* before appending to a file */
Karsten Hopp 78e568
!     EVENT_FILEAPPENDCMD,	/* append to a file using command */
Karsten Hopp 78e568
      EVENT_FILECHANGEDSHELL,	/* after shell command that changed file */
Karsten Hopp 78e568
      EVENT_FILECHANGEDSHELLPOST,	/* after (not) reloading changed file */
Karsten Hopp 78e568
      EVENT_FILECHANGEDRO,	/* before first change to read-only file */
Karsten Hopp 78e568
***************
Karsten Hopp 78e568
*** 1147,1152 ****
Karsten Hopp 78e568
--- 1147,1153 ----
Karsten Hopp 78e568
      EVENT_REMOTEREPLY,		/* upon string reception from a remote vim */
Karsten Hopp 78e568
      EVENT_SWAPEXISTS,		/* found existing swap file */
Karsten Hopp 78e568
      EVENT_SOURCEPRE,		/* before sourcing a Vim script */
Karsten Hopp 78e568
+     EVENT_SOURCECMD,		/* sourcing a Vim script using command */
Karsten Hopp 78e568
      EVENT_SPELLFILEMISSING,	/* spell file missing */
Karsten Hopp 78e568
      EVENT_CURSORMOVED,		/* cursor was moved */
Karsten Hopp 78e568
      EVENT_CURSORMOVEDI,		/* cursor was moved in Insert mode */
Karsten Hopp 78e568
*** ../vim-7.0.186/src/version.c	Tue Jan 16 16:00:38 2007
Karsten Hopp 78e568
--- src/version.c	Tue Jan 16 20:37:23 2007
Karsten Hopp 78e568
***************
Karsten Hopp 78e568
*** 668,669 ****
Karsten Hopp 78e568
--- 668,671 ----
Karsten Hopp 78e568
  {   /* Add new patch number below this line */
Karsten Hopp 78e568
+ /**/
Karsten Hopp 78e568
+     187,
Karsten Hopp 78e568
  /**/
Karsten Hopp 78e568
Karsten Hopp 78e568
-- 
Karsten Hopp 78e568
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 78e568
29. Your phone bill comes to your doorstep in a box.
Karsten Hopp 78e568
Karsten Hopp 78e568
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 78e568
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 78e568
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 78e568
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///