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