Gary Johnson wrote:
> When 'efm' is set in a compiler plugin, and the :compile command is > executed in a configuration file, ":verbose set efm?" reports the > file name of the file where :compiler was executed and the line > number of compiler plugin where ":set efm=..." was executed. > > I expected to see :verbose report either the name of the file in > which :compiler was executed and the line number of the :compiler > command, or the name of the compiler plugin and the line number > where 'efm' was set. I would prefer the latter. > > Here's an illustration of the problem. > > Create a file named vimrc (name doesn't matter) in your home > directory (directory doesn't matter) containing only this command on > line 3 (line doesn't matter but I wanted something other than 1). > > compiler ant > > Execute the following command from the shell prompt: > > $ vim -N --noplugin -u vimrc -i NONE > > Execute the following command on Vim's command line: > > :verbose set efm? > errorformat= %#[%.%#] %#%f:%l:%v:%*\d:%*\d: %t%[%^:]%#:%m,%A %#[%.%#] > %f:%l: %m,%-Z %#[%.%#] %p^,%C %#[%.%#] %#%m > Last set from ~/vimrc line 32 > > 'efm' is actually set at line 32 of $VIMRUNTIME/compiler/ant.vim. > > A similar problem occurs when executing :compiler from Vim's command > line. For example: > > $ vim -N -u NONE -i NONE > :compiler ant > :verbose set efm? > errorformat= %#[%.%#] %#%f:%l:%v:%*\d:%*\d: %t%[%^:]%#:%m,%A %#[%.%#] > %f:%l: %m,%-Z %#[%.%#] %p^,%C %#[%.%#] %#%m > > In this case, no information at all is given about where 'efm' was > set. I understand an argument that the user set 'efm' from the > command line via the :compiler command, but it's not helpful for > diagnosing problems. > > I'm using the latest vim, 8.2.3582, in an xterm on an Ubuntu 20.04.3 > system. It appears this is caused by using the "CompilerSet" user command. The script context is then set to where the command is defined. This command is added internally by the :compiler command, thus gets the script ID of where the :compiler command is executed. It appears the best solution is to add a flag to :command to have it not set the script context to where the user command was defined, but use the context of where the user command is invoked. That would be useful in other situations as well. -- A vacation is a period of travel during which you find that you took twice as many clothes and half as much money as you needed. /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- 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/20211112111654.92BADC80053%40moolenaar.net.
