Currently, I edit LaTeX files by running latexmk -pvc in the background to generate PDF automatically upon change to be previewed in Evince. However, when there is a syntax error, AucTeX is not able to show it. How can I complete this integration by jumping to errors given by the latexmk process?
1 Answers
I have dealing with the same issue. That is my solution, it is a bit late but it could be useful.
(defun brust-LaTeX-next-error (args)
(interactive "p")
(if-let ((active-buffer (TeX-active-buffer)))
(if (< 15 args)
(TeX-error-overview)
(when (< 3 args)
(save-excursion
(set-buffer active-buffer)
(TeX-parse-all-errors)
(if TeX-error-list
(message ":::: WARNING :::: There are errors ::::")
(message ":::: Be happy, your LaTeX code has no errors ::::"))))
(call-interactively 'TeX-next-error))
(message "There is no active buffer")))
I guess that AUCTeX creates the list of errors once the compiling precess finishes.
So, the problem with latexmk -pvc is that the process never ends and the list is never created.
The idea is to replace TeX-next-error with previous function.
First, it checks whether there is an active process or not.
When you call brust-LaTeX-next-error with prefix argument C-u it creates the list from the active buffer with the same functions that AUCTeX does when the process ends (again I guess).
So, they should interact nicely.
When you call it with no prefix argument it just calls TeX-next-error.
As an extra functionality when you call it with double prefix argument C-u C-u a buffer with all errors listed is created.
- 81
- 7
TeX-next-errorandTex-previous-errordo not work? Are you usingauctex-latexmk? – Timm Nov 18 '16 at 08:57latexmk -pvcin the background so PDF gets rebuilt automatically upon saving.TeX-next-errorwon't work. – xuhdev Nov 18 '16 at 09:02auctex-latexmkwith(setq TeX-save-query nil)and the files are automatically saved when compiling withC-c C-c. I don't see much of an advantage of usinglatexmk -pvcinstead. – Timm Nov 18 '16 at 09:25