]>
Commit | Line | Data |
---|---|---|
d2415672 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.1.186 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.186 | |
11 | Problem: "expand('<afile>')" returns a bogus value after changing | |
12 | directory. (Dave Fishburn) | |
13 | Solution: Copy "autocmd_fname" to allocated memory and expand to full | |
14 | filename. Shorten the path when expanding <afile>. | |
15 | Files: src/ex_docmd.c, src/fileio.c | |
16 | ||
17 | ||
18 | *** ../vim-7.1.185/src/ex_docmd.c Wed Jan 2 15:12:29 2008 | |
19 | --- src/ex_docmd.c Wed Jan 2 20:12:33 2008 | |
20 | *************** | |
21 | *** 7799,7804 **** | |
22 | --- 7799,7805 ---- | |
23 | free_cd_dir() | |
24 | { | |
25 | vim_free(prev_dir); | |
26 | + prev_dir = NULL; | |
27 | } | |
28 | #endif | |
29 | ||
30 | *************** | |
31 | *** 9521,9526 **** | |
32 | --- 9522,9528 ---- | |
33 | *errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\""); | |
34 | return NULL; | |
35 | } | |
36 | + result = shorten_fname1(result); | |
37 | break; | |
38 | ||
39 | case SPEC_ABUF: /* buffer number for autocommand */ | |
40 | *** ../vim-7.1.185/src/fileio.c Thu Nov 8 20:47:34 2007 | |
41 | --- src/fileio.c Wed Jan 2 20:21:43 2008 | |
42 | *************** | |
43 | *** 5556,5562 **** | |
44 | #endif | |
45 | ||
46 | #if defined(FEAT_VIMINFO) || defined(FEAT_BROWSE) || \ | |
47 | ! defined(FEAT_QUICKFIX) || defined(PROTO) | |
48 | /* | |
49 | * Try to find a shortname by comparing the fullname with the current | |
50 | * directory. | |
51 | --- 5556,5562 ---- | |
52 | #endif | |
53 | ||
54 | #if defined(FEAT_VIMINFO) || defined(FEAT_BROWSE) || \ | |
55 | ! defined(FEAT_QUICKFIX) || defined(FEAT_AUTOCMD) || defined(PROTO) | |
56 | /* | |
57 | * Try to find a shortname by comparing the fullname with the current | |
58 | * directory. | |
59 | *************** | |
60 | *** 8546,8551 **** | |
61 | --- 8546,8553 ---- | |
62 | ||
63 | /* | |
64 | * Set the file name to be used for <afile>. | |
65 | + * Make a copy to avoid that changing a buffer name or directory makes it | |
66 | + * invalid. | |
67 | */ | |
68 | if (fname_io == NULL) | |
69 | { | |
70 | *************** | |
71 | *** 8558,8563 **** | |
72 | --- 8560,8567 ---- | |
73 | } | |
74 | else | |
75 | autocmd_fname = fname_io; | |
76 | + if (autocmd_fname != NULL) | |
77 | + autocmd_fname = FullName_save(autocmd_fname, FALSE); | |
78 | ||
79 | /* | |
80 | * Set the buffer number to be used for <abuf>. | |
81 | *************** | |
82 | *** 8740,8745 **** | |
83 | --- 8744,8750 ---- | |
84 | vim_free(sourcing_name); | |
85 | sourcing_name = save_sourcing_name; | |
86 | sourcing_lnum = save_sourcing_lnum; | |
87 | + vim_free(autocmd_fname); | |
88 | autocmd_fname = save_autocmd_fname; | |
89 | autocmd_bufnr = save_autocmd_bufnr; | |
90 | autocmd_match = save_autocmd_match; | |
91 | *** ../vim-7.1.185/src/version.c Wed Jan 2 17:48:24 2008 | |
92 | --- src/version.c Wed Jan 2 21:06:35 2008 | |
93 | *************** | |
94 | *** 668,669 **** | |
95 | --- 668,671 ---- | |
96 | { /* Add new patch number below this line */ | |
97 | + /**/ | |
98 | + 186, | |
99 | /**/ | |
100 | ||
101 | -- | |
102 | LAUNCELOT leaps into SHOT with a mighty cry and runs the GUARD through and | |
103 | hacks him to the floor. Blood. Swashbuckling music (perhaps). | |
104 | LAUNCELOT races through into the castle screaming. | |
105 | SECOND SENTRY: Hey! | |
106 | "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD | |
107 | ||
108 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
109 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
110 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
111 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |