Skip to content

latexmk compilation callbacks aren't called #2078

@yongrenjie

Description

@yongrenjie

Rebased the bib folding PR, then noticed that the most recent commits (specifically e823187) introduce a new bug: although latexmk compilation still works just fine (I can see changes being reflected in the PDF), none of the callbacks are invoked, e.g. quickfix opening / status echoing / PDF viewer opening. Inserting a strategic echomsg a:msg at line 515 here

function! s:callback_continuous_output(channel, msg) abort " {{{1
if exists('b:vimtex.compiler.output')
\ && filewritable(b:vimtex.compiler.output)
call writefile([a:msg], b:vimtex.compiler.output, 'aS')
endif
if a:msg ==# 'vimtex_compiler_callback_success'
call vimtex#compiler#callback(1)
elseif a:msg ==# 'vimtex_compiler_callback_failure'
call vimtex#compiler#callback(0)
endif

yields the following output:

"min1.tex" 6L, 76B
"min1.tex" 5L, 60B written
Latexmk: This is Latexmk, John Collins, 26 Dec. 2019, version: 4.67.
Not using a previewer
Rule 'pdflatex': File changes, etc:
   Changed files, or newly in use since previous run(s):
      'min1.tex'
------------
Run number 1 of rule 'pdflatex'
------------
======= Need to update make_preview_continuous for target files
Latexmk: applying rule 'pdflatex'...
------------
Running 'pdflatex  -file-line-error -synctex=1 -interaction=nonstopmode -recorder  "min1.tex"'
------------
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./min1.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-03-06> (/usr/local/texlive/2020/texmf-dist/tex/latex/base/article.cl
s
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/size10.clo)) (/usr/local/texlive/2020/texmf-
dist/tex/latex/l3backend/l3backend-pdfmode.def) (./min1.aux) [1{/usr/local/texlive/2020/texmf-v
ar/fonts/map/pdftex/updmap/pdftex.map}] (./min1.aux) )</usr/local/texlive/2020/texmf-dist/fonts
/type1/public/amsfonts/cm/cmr10.pfb>
Output written on min1.pdf (1 page, 10693 bytes).
SyncTeX written on min1.synctex.gz.
Transcript written on min1.log.
Latexmk: Log file says output to 'min1.pdf'
------------
Running ';echo vimtex_compiler_callback_success'
------------
=== TeX engine is 'pdfTeX'
Latexmk: All targets () are up-to-date
sh: -c: line 0: syntax error near unexpected token `;'
sh: -c: line 0: `;echo vimtex_compiler_callback_success'

which causes the comparisons on lines 516 & 518 to fail.

It seems that (for me at least; I'm really quite unfamiliar with latexmk beyond that it 'works for me') $success_cmd is originally nothing, and appending ; echo vimtex_compiler_callback_success to an empty string (in the new function s:wrap_option_appendcmd) is problematic.

(I'm on Vim 8, macOS, and min1.tex is the following.)

\documentclass{article}

\begin{document}
Hi
\end{document}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions