Patch 8.2.3584
Problem: "verbose set efm" reports the location of the :compiler command.
(Gary Johnson)
Solution: Add the "-keepscript" argument to :command and use it when
defining CompilerSet.
Files: runtime/doc/map.txt, src/ex_cmds2.c, src/usercmd.c, src/ex_cmds.h,
src/testdir/test_compiler.vim
*** ../vim-8.2.3583/runtime/doc/map.txt 2021-09-12 19:57:56.817929392 +0100
--- runtime/doc/map.txt 2021-11-12 11:07:53.986858400 +0000
***************
*** 1547,1552 ****
--- 1571,1579 ----
-register The first argument to the command can be an optional
register name (like :del, :put, :yank).
-buffer The command will only be available in the current buffer.
+ -keepscript Do not use the location of where the user command was
+ defined for verbose messages, use the location of where
+ the user command was invoked.
In the cases of the -count and -register attributes, if the optional argument
is supplied, it is removed from the argument list and is available to the
*** ../vim-8.2.3583/src/ex_cmds2.c 2021-07-20 20:07:32.964058857 +0100
--- src/ex_cmds2.c 2021-11-12 11:09:47.485653931 +0000
***************
*** 754,760 ****
if (old_cur_comp != NULL)
old_cur_comp = vim_strsave(old_cur_comp);
do_cmdline_cmd((char_u *)
! "command -nargs=* CompilerSet setlocal <args>");
}
do_unlet((char_u *)"g:current_compiler", TRUE);
do_unlet((char_u *)"b:current_compiler", TRUE);
--- 754,760 ----
if (old_cur_comp != NULL)
old_cur_comp = vim_strsave(old_cur_comp);
do_cmdline_cmd((char_u *)
! "command -nargs=* -keepscript CompilerSet setlocal <args>");
}
do_unlet((char_u *)"g:current_compiler", TRUE);
do_unlet((char_u *)"b:current_compiler", TRUE);
*** ../vim-8.2.3583/src/usercmd.c 2021-09-12 19:57:56.821929392 +0100
--- src/usercmd.c 2021-11-12 11:23:12.176634186 +0000
***************
*** 360,366 ****
{
static char *user_cmd_flags[] = {
"addr", "bang", "bar", "buffer", "complete",
! "count", "nargs", "range", "register"
};
if (idx >= (int)ARRAY_LENGTH(user_cmd_flags))
--- 360,366 ----
{
static char *user_cmd_flags[] = {
"addr", "bang", "bar", "buffer", "complete",
! "count", "nargs", "range", "register", "keepscript"
};
if (idx >= (int)ARRAY_LENGTH(user_cmd_flags))
***************
*** 735,740 ****
--- 735,742 ----
*flags |= UC_BUFFER;
else if (STRNICMP(attr, "register", len) == 0)
*argt |= EX_REGSTR;
+ else if (STRNICMP(attr, "keepscript", len) == 0)
+ *argt |= EX_KEEPSCRIPT;
else if (STRNICMP(attr, "bar", len) == 0)
*argt |= EX_TRLBAR;
else
***************
*** 1764,1776 ****
}
}
! current_sctx.sc_version = cmd->uc_script_ctx.sc_version;
#ifdef FEAT_EVAL
! current_sctx.sc_sid = cmd->uc_script_ctx.sc_sid;
#endif
(void)do_cmdline(buf, eap->getline, eap->cookie,
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED);
! current_sctx = save_current_sctx;
vim_free(buf);
vim_free(split_buf);
}
--- 1766,1782 ----
}
}
! if ((cmd->uc_argt & EX_KEEPSCRIPT) == 0)
! {
! current_sctx.sc_version = cmd->uc_script_ctx.sc_version;
#ifdef FEAT_EVAL
! current_sctx.sc_sid = cmd->uc_script_ctx.sc_sid;
#endif
+ }
(void)do_cmdline(buf, eap->getline, eap->cookie,
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED);
! if ((cmd->uc_argt & EX_KEEPSCRIPT) == 0)
! current_sctx = save_current_sctx;
vim_free(buf);
vim_free(split_buf);
}
*** ../vim-8.2.3583/src/ex_cmds.h 2021-09-04 12:43:57.928929327 +0100
--- src/ex_cmds.h 2021-11-12 11:12:25.129467575 +0000
***************
*** 56,61 ****
--- 56,62 ----
// set; when missing disallows editing another
// buffer when curbuf_lock is set
#define EX_NONWHITE_OK 0x2000000 // command can be followed by non-white
+ #define EX_KEEPSCRIPT 0x4000000 // keep sctx of where command was invoked
#define EX_FILES (EX_XFILE | EX_EXTRA) // multiple extra files allowed
#define EX_FILE1 (EX_FILES | EX_NOSPC) // 1 file, defaults to current file
*** ../vim-8.2.3583/src/testdir/test_compiler.vim 2021-04-03 18:07:02.106066631 +0100
--- src/testdir/test_compiler.vim 2021-11-12 11:21:24.838152067 +0000
***************
*** 21,26 ****
--- 21,29 ----
call assert_equal('perl', b:current_compiler)
call assert_fails('let g:current_compiler', 'E121:')
+ let verbose_efm = execute('verbose set efm')
+ call assert_match('Last set from .*/compiler/perl.vim ', verbose_efm)
+
call setline(1, ['#!/usr/bin/perl -w', 'use strict;', 'my $foo=1'])
w!
call feedkeys(":make\<CR>\<CR>", 'tx')
*** ../vim-8.2.3583/src/version.c 2021-11-12 10:29:42.178810539 +0000
--- src/version.c 2021-11-12 11:17:18.432413229 +0000
***************
*** 759,760 ****
--- 759,762 ----
{ /* Add new patch number below this line */
+ /**/
+ 3584,
/**/
--
Overflow on /dev/null, please empty the bit bucket.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///