On 29-Dec-2021 00:16, Bram Moolenaar wrote:
Patch 8.2.3920
Problem: Restoring directory after using another window is inefficient.
Solution: Only restore the directory for win_execute(). Apply 'autochdir'
only when needed.
Files: src/evalwindow.c, src/testdir/test_autochdir.vim
After this patch, mingw64 (gcc 11.2.0) spits out this error message if
FEAT_AUTOCHDIR is not defined (which is only defined if
FEAT_NETBEANS_INTG or FEAT_BIG are defined):
<snip>
gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO
-pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return
-fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD evalwindow.c -o
gobjnative/evalwindow.o
evalwindow.c: In function 'f_win_execute':
evalwindow.c:719:33: error: 'p_acd' undeclared (first use in this function)
719 | if (cwd_status == OK && p_acd)
| ^~~~~
evalwindow.c:719:33: note: each undeclared identifier is reported only
once for each function it appears in
make: *** [Make_cyg_ming.mak:1162: gobjnative/evalwindow.o] Error 1
</snip>
The attached patch makes the error go away but I'm not sure that it is
correct.
Cheers
John
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/d5abd208-c29c-5912-bed1-6f47b4d7f651%40internode.on.net.
--- evalwindow.c.orig 2021-12-29 06:15:24.855364100 +1100
+++ evalwindow.c 2021-12-29 06:38:46.010940000 +1100
@@ -707,6 +707,7 @@
if (wp != NULL && tp != NULL)
{
pos_T curpos = wp->w_cursor;
+#ifdef FEAT_AUTOCHDIR
char_u cwd[MAXPATHL];
int cwd_status;
char_u autocwd[MAXPATHL];
@@ -722,6 +723,7 @@
apply_acd = mch_dirname(autocwd, MAXPATHL) == OK
&& STRCMP(cwd, autocwd) == 0;
}
+#endif
if (switch_win_noblock(&save_curwin, &save_curtab, wp, tp, TRUE) == OK)
{
@@ -729,10 +731,12 @@
execute_common(argvars, rettv, 1);
}
restore_win_noblock(save_curwin, save_curtab, TRUE);
+#ifdef FEAT_AUTOCHDIR
if (apply_acd)
do_autochdir();
else if (cwd_status == OK)
mch_chdir((char *)cwd);
+#endif
// Update the status line if the cursor moved.
if (win_valid(wp) && !EQUAL_POS(curpos, wp->w_cursor))