]> git.pld-linux.org Git - packages/vim.git/blob - 7.2.021
- updated to 7.2.102
[packages/vim.git] / 7.2.021
1 To: vim-dev@vim.org
2 Subject: Patch 7.2.021
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.2.021
11 Problem:    When executing autocommands getting the full file name may be
12             slow. (David Kotchan)
13 Solution:   Postpone calling FullName_save() until autocmd_fname is used.
14 Files:      src/ex_docmd.c, src/fileio.c, src/globals.h
15
16
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
19 ***************
20 *** 9542,9547 ****
21 --- 9569,9583 ----
22   #ifdef FEAT_AUTOCMD
23         case SPEC_AFILE:        /* file name for autocommand */
24                 result = autocmd_fname;
25 +               if (result != NULL && !autocmd_fname_full)
26 +               {
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;
33 +               }
34                 if (result == NULL)
35                 {
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
39 ***************
40 *** 8523,8528 ****
41 --- 8523,8529 ----
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;
49 ***************
50 *** 8601,8606 ****
51 --- 8602,8608 ----
52        * Save the autocmd_* variables and info about the current buffer.
53        */
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;
59 ***************
60 *** 8618,8631 ****
61         if (fname != NULL && *fname != NUL)
62             autocmd_fname = fname;
63         else if (buf != NULL)
64 !           autocmd_fname = buf->b_fname;
65         else
66             autocmd_fname = NULL;
67       }
68       else
69         autocmd_fname = fname_io;
70       if (autocmd_fname != NULL)
71 !       autocmd_fname = FullName_save(autocmd_fname, FALSE);
72   
73       /*
74        * Set the buffer number to be used for <abuf>.
75 --- 8620,8634 ----
76         if (fname != NULL && *fname != NUL)
77             autocmd_fname = fname;
78         else if (buf != NULL)
79 !           autocmd_fname = buf->b_ffname;
80         else
81             autocmd_fname = NULL;
82       }
83       else
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 */
88   
89       /*
90        * Set the buffer number to be used for <abuf>.
91 ***************
92 *** 8810,8815 ****
93 --- 8813,8819 ----
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;
100   #ifdef FEAT_EVAL
101 ***************
102 *** 8918,8924 ****
103       {
104         apc->curpat = NULL;
105   
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
108          * buffer number. */
109         if (ap->pat != NULL && ap->cmds != NULL
110 --- 8922,8928 ----
111       {
112         apc->curpat = NULL;
113   
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
116          * buffer number. */
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
120 ***************
121 *** 1022,1027 ****
122 --- 1022,1028 ----
123   #endif
124   #ifdef FEAT_AUTOCMD
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
132 ***************
133 *** 678,679 ****
134 --- 678,681 ----
135   {   /* Add new patch number below this line */
136 + /**/
137 +     21,
138   /**/
139
140 -- 
141 From "know your smileys":
142  :----}  You lie like Pinocchio
143
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    ///
This page took 0.100382 seconds and 3 git commands to generate.