branch: externals/auctex-cont-latexmk
commit b34fcf062a11e1ab6dd6315b4fb405d7324fd088
Author: Paul Nelson <ultr...@gmail.com>
Commit: Paul Nelson <ultr...@gmail.com>

    add local variable tex-continuous-force-enable
    
    This can be used to test the Flymake backend in other contexts.
---
 auctex-cont-latexmk.el | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/auctex-cont-latexmk.el b/auctex-cont-latexmk.el
index ee633e14e6..f9250cc8a2 100644
--- a/auctex-cont-latexmk.el
+++ b/auctex-cont-latexmk.el
@@ -163,9 +163,12 @@ Return a list of triples as in the docstring of
 (defvar-local tex-continuous--report-fn nil
   "Function provided by Flymake for reporting diagnostics.")
 
-(defun tex-continuous--clone-indirect-buffer-hook ()
-  "Set `tex-continuous--report-fn' to nil after cloning an indirect buffer."
-  (setq tex-continuous--report-fn nil))
+(defvar-local tex-continuous-force-enable nil
+  "Whether to enable the Flymake backend unconditionally.
+This is non-nil if we should enable the Flymake backend independent of
+whether `tex-continuous-mode' is enabled.  This may be useful for
+testing or applying the backend in other contexts, e.g., in the context
+of AUCTeX's built-in compilation functions.")
 
 (defun tex-continuous-flymake (report-fn &rest _args)
   "Flymake backend for LaTeX based on latexmk.
@@ -175,7 +178,7 @@ report diagnostics."
   ;; spamming random buffers with report functions.  Could easily
   ;; replace this with some other check if we wanted to use the
   ;; Flymake backend provided here in other situations.
-  (when tex-continuous-mode
+  (when (or tex-continuous-mode tex-continuous-force-enable)
     (setq tex-continuous--report-fn report-fn)))
 
 (defun tex-continuous-send-report ()
@@ -191,6 +194,13 @@ report diagnostics."
          description)))
     (tex-continuous-process-log))))
 
+(defun tex-continuous--clone-indirect-buffer-hook ()
+  "Set `tex-continuous--report-fn' to nil after cloning an indirect buffer.
+This should be added to `clone-indirect-buffer-hook' for any buffer in
+which the Flymake backend is used.  This is because we don't want the
+Flymake report function to propagate to indirect buffers."
+  (setq tex-continuous--report-fn nil))
+
 ;;; Continuous Compilation
 
 (defcustom tex-continuous-command

Reply via email to