Reputation: 1390
Consider a the following minimal vimrc:
set nocompatible
filetype plugin indent on
let g:tex_flavor = 'latex'
function! CompileLatex()
let save_pwd = getcwd()
lcd %:p:h
let compiler = 'pdflatex '
let mainfile = expand('%:p:r')
let &l:makeprg = compiler . mainfile . '.tex'
echon "compiling latex file..."
silent make!
execute 'lcd ' . save_pwd
endfunction
function! EchoLatexMessage()
redraw
echo 'This message is not shown'
endfunction
augroup echo_message
au!
au QuickFixCmdPost make call EchoLatexMessage()
augroup END
And in a foo.tex
file like:
\documentclass{article}
\begin{document}
Foo
\end{document}
run :call CompileLatex()
. As seen in the GIF the message This message is not shown
from function EchoLatexMessage()
is not shown (on the other hand the message compiling latex file...
is always on screen). Why is this happening? I expect the new message to be echoed once :make
finishes.
Upvotes: 1
Views: 80
Reputation: 172540
This is because of the silent make!
in your function. The :silent
apparently not only applies to the :make
itself, but also to the autocmds invoked by it (which sort of makes sense). If you want to silence the compilation output itself, but not the messages from the autocmd, you can prepend :unsilent
to :echo
in the EchoLatexMessage()
function.
Upvotes: 1