4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: When executing autocommands getting the full file name may be
13 Solution: Postpone calling FullName_save() until autocmd_fname is used.
14 Files: src/ex_docmd.c, src/fileio.c, src/globals.h
17 *** ../vim-7.2.020/src/ex_docmd.c Thu Sep 18 12:43:21 2008
18 --- src/ex_docmd.c Mon Sep 15 20:04:53 2008
23 case SPEC_AFILE: /* file name for autocommand */
24 result = autocmd_fname;
25 + if (result != NULL && !autocmd_fname_full)
27 + /* Still need to turn the fname into a full path. It is
28 + * postponed to avoid a delay when <afile> is not used. */
29 + autocmd_fname_full = TRUE;
30 + result = FullName_save(autocmd_fname, FALSE);
31 + vim_free(autocmd_fname);
32 + autocmd_fname = result;
36 *errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\"");
37 *** ../vim-7.2.020/src/fileio.c Wed Aug 6 18:43:07 2008
38 --- src/fileio.c Tue Sep 16 21:24:26 2008
42 char_u *save_sourcing_name;
43 linenr_T save_sourcing_lnum;
44 char_u *save_autocmd_fname;
45 + int save_autocmd_fname_full;
46 int save_autocmd_bufnr;
47 char_u *save_autocmd_match;
48 int save_autocmd_busy;
52 * Save the autocmd_* variables and info about the current buffer.
54 save_autocmd_fname = autocmd_fname;
55 + save_autocmd_fname_full = autocmd_fname_full;
56 save_autocmd_bufnr = autocmd_bufnr;
57 save_autocmd_match = autocmd_match;
58 save_autocmd_busy = autocmd_busy;
61 if (fname != NULL && *fname != NUL)
62 autocmd_fname = fname;
64 ! autocmd_fname = buf->b_fname;
69 autocmd_fname = fname_io;
70 if (autocmd_fname != NULL)
71 ! autocmd_fname = FullName_save(autocmd_fname, FALSE);
74 * Set the buffer number to be used for <abuf>.
76 if (fname != NULL && *fname != NUL)
77 autocmd_fname = fname;
79 ! autocmd_fname = buf->b_ffname;
84 autocmd_fname = fname_io;
85 if (autocmd_fname != NULL)
86 ! autocmd_fname = vim_strsave(autocmd_fname);
87 ! autocmd_fname_full = FALSE; /* call FullName_save() later */
90 * Set the buffer number to be used for <abuf>.
94 sourcing_lnum = save_sourcing_lnum;
95 vim_free(autocmd_fname);
96 autocmd_fname = save_autocmd_fname;
97 + autocmd_fname_full = save_autocmd_fname_full;
98 autocmd_bufnr = save_autocmd_bufnr;
99 autocmd_match = save_autocmd_match;
106 ! /* only use a pattern when it has not been removed, has commands and
107 * the group matches. For buffer-local autocommands only check the
109 if (ap->pat != NULL && ap->cmds != NULL
114 ! /* Only use a pattern when it has not been removed, has commands and
115 * the group matches. For buffer-local autocommands only check the
117 if (ap->pat != NULL && ap->cmds != NULL
118 *** ../vim-7.2.020/src/globals.h Sat Jul 26 16:04:49 2008
119 --- src/globals.h Mon Sep 15 19:59:28 2008
125 EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */
126 + EXTERN int autocmd_fname_full; /* autocmd_fname is full path */
127 EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */
128 EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */
129 EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */
130 *** ../vim-7.2.020/src/version.c Thu Sep 18 20:55:19 2008
131 --- src/version.c Thu Sep 18 21:24:30 2008
135 { /* Add new patch number below this line */
141 From "know your smileys":
142 :----} You lie like Pinocchio
144 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
145 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
146 \\\ download, build and distribute -- http://www.A-A-P.org ///
147 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///