vim-patch:3456303: check.vim: Use silent command modifier

Problem:  When checking a .po file (make -C src/po check), errors are not
          displayed.

Solution: Adding "silent" to some normal commands in check.vim
          suppresses unnecessary output (Muraoka Taro)

This is because the output of check.vim is redirected to /dev/null.
However, if you stop the redirection, check.vim generates a lot of
output and becomes very slow.

When these commands are run in ex mode, they output the contents of the
line the cursor is pointing to.  This caused a lot of output.

closes: vim/vim#19227

3456303430

Co-authored-by: Muraoka Taro <koron.kaoriya@gmail.com>
This commit is contained in:
zeertzjq
2026-01-22 13:40:49 +08:00
parent 5f86b4b70d
commit cae4fbf973

View File

@@ -25,7 +25,7 @@ exe 'redir! > ' . filename
func! GetMline() func! GetMline()
let idline = substitute(getline('.'), '"\(.*\)"$', '\1', '') let idline = substitute(getline('.'), '"\(.*\)"$', '\1', '')
while line('.') < line('$') while line('.') < line('$')
+ silent +
let line = getline('.') let line = getline('.')
if line[0] != '"' if line[0] != '"'
break break
@@ -63,8 +63,8 @@ endfunc
" Start at the first "msgid" line. " Start at the first "msgid" line.
let wsv = winsaveview() let wsv = winsaveview()
1 silent 1
keeppatterns /^msgid\> silent keeppatterns /^msgid\>
" When an error is detected this is set to the line number. " When an error is detected this is set to the line number.
" Note: this is used in the Makefile. " Note: this is used in the Makefile.
@@ -157,7 +157,7 @@ endwhile
" - msgstr "E123 ..." missing colon " - msgstr "E123 ..." missing colon
" - msgstr "..." missing error code " - msgstr "..." missing error code
" "
1 silent 1
if search('msgid "\("\n"\)\?\([EW][0-9]\+:\).*\nmsgstr "\("\n"\)\?[^"]\@=\2\@!') > 0 if search('msgid "\("\n"\)\?\([EW][0-9]\+:\).*\nmsgstr "\("\n"\)\?[^"]\@=\2\@!') > 0
echomsg 'Mismatching error/warning code in line ' . line('.') echomsg 'Mismatching error/warning code in line ' . line('.')
if error == 0 if error == 0
@@ -167,8 +167,8 @@ endif
" Check that the \n at the end of the msgid line is also present in the msgstr " Check that the \n at the end of the msgid line is also present in the msgstr
" line. Skip over the header. " line. Skip over the header.
1 silent 1
keeppatterns /^"MIME-Version: silent keeppatterns /^"MIME-Version:
while 1 while 1
let lnum = search('^msgid\>') let lnum = search('^msgid\>')
if lnum <= 0 if lnum <= 0
@@ -194,8 +194,8 @@ endwhile
" final '""', '\n"', ' "' '/"' '."' '-"' are OK " final '""', '\n"', ' "' '/"' '."' '-"' are OK
" Beware, it can give false positives if the message is split " Beware, it can give false positives if the message is split
" in the middle of a word " in the middle of a word
1 silent 1
keeppatterns /^"MIME-Version: silent keeppatterns /^"MIME-Version:
while 1 while 1
let lnum = search('^msgid\>') let lnum = search('^msgid\>')
if lnum <= 0 if lnum <= 0
@@ -262,7 +262,7 @@ if executable("msgfmt")
endif endif
" Check that the plural form is properly initialized " Check that the plural form is properly initialized
1 silent 1
let plural = search('^msgid_plural ', 'n') let plural = search('^msgid_plural ', 'n')
if (plural && search('^"Plural-Forms: ', 'n') == 0) || (plural && search('^msgstr\[0\] ".\+"', 'n') != plural + 1) if (plural && search('^"Plural-Forms: ', 'n') == 0) || (plural && search('^msgstr\[0\] ".\+"', 'n') != plural + 1)
if search('^"Plural-Forms: ', 'n') == 0 if search('^"Plural-Forms: ', 'n') == 0