]> git.pld-linux.org Git - packages/vim.git/blob - 7.0.087
- new
[packages/vim.git] / 7.0.087
1 To: vim-dev@vim.org
2 Subject: Patch 7.0.087
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.0.087
11 Problem:    After ":file fname" and ":saveas fname" the 'autochdir' option
12             does not take effect. (Yakov Lerner)
13             Commands for handling 'autochdir' are repeated many times.
14 Solution:   Add the DO_AUTOCHDIR macro and do_autochdir().  Use it for
15             ":file fname" and ":saveas fname".
16 Files:      src/proto/buffer.pro, src/buffer.c, src/ex_cmds.c, src/macros.h,
17             src/option.c, src/window.c
18
19
20 *** ../vim-7.0.086/src/proto/buffer.pro Sun Apr 30 20:25:32 2006
21 --- src/proto/buffer.pro        Tue Sep  5 16:25:40 2006
22 ***************
23 *** 10,15 ****
24 --- 10,16 ----
25   extern int do_buffer __ARGS((int action, int start, int dir, int count, int forceit));
26   extern void set_curbuf __ARGS((buf_T *buf, int action));
27   extern void enter_buffer __ARGS((buf_T *buf));
28 + extern void do_autochdir __ARGS((void));
29   extern buf_T *buflist_new __ARGS((char_u *ffname, char_u *sfname, linenr_T lnum, int flags));
30   extern void free_buf_options __ARGS((buf_T *buf, int free_p_ff));
31   extern int buflist_getfile __ARGS((int n, linenr_T lnum, int options, int forceit));
32 *** ../vim-7.0.086/src/buffer.c Tue Aug 29 16:52:01 2006
33 --- src/buffer.c        Tue Sep  5 15:18:19 2006
34 ***************
35 *** 434,445 ****
36       if (usingNetbeans)
37         netbeans_file_closed(buf);
38   #endif
39 ! #ifdef FEAT_AUTOCHDIR
40 !     /* Change directories when the acd option is set on. */
41 !     if (p_acd && curbuf->b_ffname != NULL
42 !                                    && vim_chdirfile(curbuf->b_ffname) == OK)
43 !       shorten_fnames(TRUE);
44 ! #endif
45   
46       /*
47        * Remove the buffer from the list.
48 --- 434,441 ----
49       if (usingNetbeans)
50         netbeans_file_closed(buf);
51   #endif
52 !     /* Change directories when the 'acd' option is set. */
53 !     DO_AUTOCHDIR
54   
55       /*
56        * Remove the buffer from the list.
57 ***************
58 *** 1422,1433 ****
59         netbeans_file_activated(curbuf);
60   #endif
61   
62 ! #ifdef FEAT_AUTOCHDIR
63 !     /* Change directories when the acd option is set on. */
64 !     if (p_acd && curbuf->b_ffname != NULL
65 !                                    && vim_chdirfile(curbuf->b_ffname) == OK)
66 !       shorten_fnames(TRUE);
67 ! #endif
68   
69   #ifdef FEAT_KEYMAP
70       if (curbuf->b_kmap_state & KEYMAP_INIT)
71 --- 1418,1425 ----
72         netbeans_file_activated(curbuf);
73   #endif
74   
75 !     /* Change directories when the 'acd' option is set. */
76 !     DO_AUTOCHDIR
77   
78   #ifdef FEAT_KEYMAP
79       if (curbuf->b_kmap_state & KEYMAP_INIT)
80 ***************
81 *** 1435,1440 ****
82 --- 1427,1444 ----
83   #endif
84       redraw_later(NOT_VALID);
85   }
86
87 + #if defined(FEAT_AUTOCHDIR) || defined(PROTO)
88 + /*
89 +  * Change to the directory of the current buffer.
90 +  */
91 +     void
92 + do_autochdir()
93 + {
94 +     if (curbuf->b_ffname != NULL && vim_chdirfile(curbuf->b_ffname) == OK)
95 +       shorten_fnames(TRUE);
96 + }
97 + #endif
98   
99   /*
100    * functions for dealing with the buffer list
101 *** ../vim-7.0.086/src/ex_cmds.c        Tue Aug 29 17:28:56 2006
102 --- src/ex_cmds.c       Tue Sep  5 15:24:58 2006
103 ***************
104 *** 2458,2463 ****
105 --- 2458,2465 ----
106   #ifdef FEAT_AUTOCMD
107         apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
108   #endif
109 +       /* Change directories when the 'acd' option is set. */
110 +       DO_AUTOCHDIR
111       }
112       /* print full file name if :cd used */
113       fileinfo(FALSE, FALSE, eap->forceit);
114 ***************
115 *** 2675,2682 ****
116                                  eap, eap->append, eap->forceit, TRUE, FALSE);
117   
118         /* After ":saveas fname" reset 'readonly'. */
119 !       if (eap->cmdidx == CMD_saveas && retval == OK)
120 !           curbuf->b_p_ro = FALSE;
121       }
122   
123   theend:
124 --- 2677,2689 ----
125                                  eap, eap->append, eap->forceit, TRUE, FALSE);
126   
127         /* After ":saveas fname" reset 'readonly'. */
128 !       if (eap->cmdidx == CMD_saveas)
129 !       {
130 !           if (retval == OK)
131 !               curbuf->b_p_ro = FALSE;
132 !           /* Change directories when the 'acd' option is set. */
133 !           DO_AUTOCHDIR
134 !       }
135       }
136   
137   theend:
138 ***************
139 *** 3547,3557 ****
140         foldUpdateAll(curwin);
141   #endif
142   
143 ! #ifdef FEAT_AUTOCHDIR
144 !       if (p_acd && curbuf->b_ffname != NULL
145 !                                    && vim_chdirfile(curbuf->b_ffname) == OK)
146 !           shorten_fnames(TRUE);
147 ! #endif
148         /*
149          * Careful: open_buffer() and apply_autocmds() may change the current
150          * buffer and window.
151 --- 3554,3562 ----
152         foldUpdateAll(curwin);
153   #endif
154   
155 !       /* Change directories when the 'acd' option is set. */
156 !       DO_AUTOCHDIR
157
158         /*
159          * Careful: open_buffer() and apply_autocmds() may change the current
160          * buffer and window.
161 ***************
162 *** 3718,3729 ****
163       if (p_im)
164         need_start_insertmode = TRUE;
165   
166 ! #ifdef FEAT_AUTOCHDIR
167 !     /* Change directories when the acd option is set on. */
168 !     if (p_acd && curbuf->b_ffname != NULL
169 !                                    && vim_chdirfile(curbuf->b_ffname) == OK)
170 !       shorten_fnames(TRUE);
171 ! #endif
172   
173   #if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG)
174       if (gui.in_use && curbuf->b_ffname != NULL)
175 --- 3723,3730 ----
176       if (p_im)
177         need_start_insertmode = TRUE;
178   
179 !     /* Change directories when the 'acd' option is set. */
180 !     DO_AUTOCHDIR
181   
182   #if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG)
183       if (gui.in_use && curbuf->b_ffname != NULL)
184 *** ../vim-7.0.086/src/macros.h Wed Mar  1 23:00:25 2006
185 --- src/macros.h        Tue Sep  5 15:15:30 2006
186 ***************
187 *** 276,278 ****
188 --- 276,284 ----
189   # define MB_CHARLEN(p)                STRLEN(p)
190   # define PTR2CHAR(p)          ((int)*(p))
191   #endif
192
193 + #ifdef FEAT_AUTOCHDIR
194 + # define DO_AUTOCHDIR if (p_acd) do_autochdir();
195 + #else
196 + # define DO_AUTOCHDIR
197 + #endif
198 *** ../vim-7.0.086/src/option.c Tue Aug 29 17:28:56 2006
199 --- src/option.c        Tue Sep  5 15:20:04 2006
200 ***************
201 *** 7326,7334 ****
202   #ifdef FEAT_AUTOCHDIR
203       else if ((int *)varp == &p_acd)
204       {
205 !       if (p_acd && curbuf->b_ffname != NULL
206 !                                    && vim_chdirfile(curbuf->b_ffname) == OK)
207 !           shorten_fnames(TRUE);
208       }
209   #endif
210   
211 --- 7326,7333 ----
212   #ifdef FEAT_AUTOCHDIR
213       else if ((int *)varp == &p_acd)
214       {
215 !       /* Change directories when the 'acd' option is set now. */
216 !       DO_AUTOCHDIR
217       }
218   #endif
219   
220 *** ../vim-7.0.086/src/window.c Tue Aug 29 17:28:56 2006
221 --- src/window.c        Tue Sep  5 15:20:35 2006
222 ***************
223 *** 3954,3966 ****
224       setmouse();                       /* in case jumped to/from help buffer */
225   #endif
226   
227 ! #ifdef FEAT_AUTOCHDIR
228 !     /* Change directories when the 'acd' option is set on and after
229 !      * switching windows. */
230 !     if (p_acd && curbuf->b_ffname != NULL
231 !                                    && vim_chdirfile(curbuf->b_ffname) == OK)
232 !       shorten_fnames(TRUE);
233 ! #endif
234   }
235   
236   #endif /* FEAT_WINDOWS */
237 --- 3954,3961 ----
238       setmouse();                       /* in case jumped to/from help buffer */
239   #endif
240   
241 !     /* Change directories when the 'acd' option is set. */
242 !     DO_AUTOCHDIR
243   }
244   
245   #endif /* FEAT_WINDOWS */
246 *** ../vim-7.0.086/src/version.c        Tue Sep  5 15:36:30 2006
247 --- src/version.c       Tue Sep  5 15:52:45 2006
248 ***************
249 *** 668,669 ****
250 --- 668,671 ----
251   {   /* Add new patch number below this line */
252 + /**/
253 +     87,
254   /**/
255
256 -- 
257 Overflow on /dev/null, please empty the bit bucket.
258
259  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
260 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
261 \\\        download, build and distribute -- http://www.A-A-P.org        ///
262  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.044771 seconds and 3 git commands to generate.