]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1158: :verbose set has wrong file name with :compiler! v9.1.1158
authorzeertzjq <zeertzjq@outlook.com>
Fri, 28 Feb 2025 16:32:07 +0000 (17:32 +0100)
committerChristian Brabandt <cb@256bit.org>
Fri, 28 Feb 2025 16:32:07 +0000 (17:32 +0100)
Problem:  :verbose set has wrong file name with :compiler!
Solution: Add -keepscript (zeertzjq)

closes: #16752

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/ex_cmds2.c
src/testdir/test_compiler.vim
src/version.c

index 0681153179e538c71bf0f3a41e98d96a744da9aa..567522c22c7884c1139583034a194456ec597d76 100644 (file)
@@ -789,7 +789,7 @@ ex_compiler(exarg_T *eap)
     {
        // ":compiler! {name}" sets global options
        do_cmdline_cmd((char_u *)
-               "command -nargs=* CompilerSet set <args>");
+               "command -nargs=* -keepscript CompilerSet set <args>");
     }
     else
     {
index 99f472401d49eb1e9591f062c6304ece577c87e0..d86c55f1c7dfc986485f92f22cae8a7094d40eed 100644 (file)
@@ -17,12 +17,14 @@ func Test_compiler()
   e Xfoo.pl
   " Play nice with other tests.
   defer setqflist([])
+
   compiler perl
   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)
+  " Not using the global value
+  call assert_notequal('', &l:efm)
 
   call setline(1, ['#!/usr/bin/perl -w', 'use strict;', 'my $foo=1'])
   w!
@@ -36,6 +38,29 @@ func Test_compiler()
   call assert_match('\n \d\+ Xfoo.pl:3: Global symbol "$foo" '
   \ .               'requires explicit package name', a)
 
+  compiler make
+  call assert_fails('let b:current_compiler', 'E121:')
+  call assert_fails('let g:current_compiler', 'E121:')
+  let verbose_efm = execute('verbose set efm')
+  call assert_match('Last set from .*[/\\]compiler[/\\]make.vim ', verbose_efm)
+
+  compiler! perl
+  call assert_equal('perl', b:current_compiler)
+  call assert_equal('perl', g:current_compiler)
+  let verbose_efm = execute('verbose set efm')
+  call assert_match('Last set from .*[/\\]compiler[/\\]perl.vim ', verbose_efm)
+  call assert_equal(verbose_efm, execute('verbose setglobal efm'))
+  " Using the global value
+  call assert_equal('', &l:efm)
+
+  compiler! make
+  call assert_fails('let b:current_compiler', 'E121:')
+  call assert_fails('let g:current_compiler', 'E121:')
+  let verbose_efm = execute('verbose set efm')
+  call assert_match('Last set from .*[/\\]compiler[/\\]make.vim ', verbose_efm)
+  call assert_equal(verbose_efm, execute('verbose setglobal efm'))
+  " Using the global value
+  call assert_equal('', &l:efm)
 
   let &shellslash = save_shellslash
   call delete('Xfoo.pl')
index 94db286ee63d3d85a078104ba403c13826c7e0a3..3b61cdd8e6d61bb065c0d981a2844f9bb4427ff8 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1158,
 /**/
     1157,
 /**/