Hi all, I wanted to get errors and warnings produced during compilation of LaTeX documents using flymake which is the interface I am used to getting such information from. With TeX-parse-all-errors non-nil, it is straightforward to implement a flymake backend,
(defun latex-refs--make-flymake-diagonostic (item) "Turn an error or warning ITEM from `TeX-error-list' to a flymake diagnostic." (goto-char (point-min)) (when (and (not (nth 10 item)) (search-forward (nth 6 item) nil t)) (flymake-make-diagnostic (current-buffer) (match-beginning 0) (match-end 0) (if (eq (nth 0 item) 'error) :error :warning) (nth 3 item)))) ;;;###autoload (defun latex-refs-flymake-diagnostic-fun (report-fun &rest _args) "A flymake diagnostic function based on `TeX-error-list'. See `flymake-diagnostic-functions' for REPORT-FUN." (when-let ((buf (TeX-active-buffer))) (funcall report-fun (save-excursion (let ((diagnostics)) (dolist (item (buffer-local-value 'TeX-error-list buf)) (push (latex-refs--make-flymake-diagonostic item) diagnostics)) (nreverse diagnostics)))))) The prefix `latex-refs` is nonsensical but I couldn't think of a better name and just threw the functions in a package I had. The function `latex-refs-flymake-diagnostic-fun` can then be added to `flymake-diagonostic-functions`. There is also a canonical time to run it which is when the compilation finishes. However it seems there is no hook that I can use to issue a `flymake-start` command at such time. `TeX-after-compilation-finished-functions` are only run if the compilation finished successfully. So instead I had to advise the sentinel. Is there a more canonical way to run something when compilation is unsuccessful? I also ended up writing another flymake backend which parse the BibTeX log files and feeds the errors to flymake. I am not sure how robust the parsing is and I need it to extend it to parse warnings too but the current state can be found at https://codeberg.org/rahguzar/latex-refs/src/commit/14c669f5d1c64760d089dd3418adcdbb31ee34c7/latex-refs.el#L174-L272 Now my questions are: 1) Is there a simpler way of getting LaTeX and BibTeX errors and warnings through flymake? 2) Flymake integrates with `project.el` so to get warnings for both tex and bib files together I also had to write a little project backend. Is there another possibly simpler way? 3) It took some configuration but I quite like the resulting setup. Are there parts of it that other people think are useful and that I can contribute to auctex proper? Thanks, Rahguzar