The attached patch sets up flymake directly in TeX-latex-mode, rather than 
putting a hook in LaTeX-mode-hook. This avoids changing LaTeX-mode-hook.

>From 805200dd9602030fc9d8e9da645a600b96862e8f Mon Sep 17 00:00:00 2001
From: Alex Branham <[email protected]>
Date: Mon, 26 Feb 2018 10:18:55 -0600
Subject: [PATCH] Refine how we setup flymake backend function

* latex.el: Add LaTeX-flymake to TeX-latex-mode
* latex-flymake.el: Don't add to LaTeX-mode-hook
---
 latex-flymake.el | 7 -------
 latex.el         | 5 ++++-
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/latex-flymake.el b/latex-flymake.el
index b06149cf..2a86ebed 100644
--- a/latex-flymake.el
+++ b/latex-flymake.el
@@ -100,12 +100,5 @@ REPORT-FN is flymake's callback function."
       (process-send-region LaTeX--flymake-proc (point-min) (point-max))
       (process-send-eof LaTeX--flymake-proc))))
 
-(defun LaTeX-setup-flymake-backend ()
-  "Setup flymake backend for LaTeX."
-  (add-hook 'flymake-diagnostic-functions 'LaTeX-flymake nil t))
-
-(when (< 25 emacs-major-version)
-  (add-hook 'LaTeX-mode-hook #'LaTeX-setup-flymake-backend))
-
 (provide 'latex-flymake)
 ;;; latex-flymake.el ends here
diff --git a/latex.el b/latex.el
index 7354c23b..d3c2e65b 100644
--- a/latex.el
+++ b/latex.el
@@ -5901,7 +5901,10 @@ of `LaTeX-mode-hook'."
   ;; Defeat filladapt
   (if (and (boundp 'filladapt-mode)
           filladapt-mode)
-      (turn-off-filladapt-mode)))
+      (turn-off-filladapt-mode))
+  (when (< 25 emacs-major-version)
+    ;; Set up flymake backend, see latex-flymake.el
+    (add-hook 'flymake-diagnostic-functions 'LaTeX-flymake nil t)))
 
 (TeX-abbrev-mode-setup doctex-mode)
 
-- 
2.16.2


>From 805200dd9602030fc9d8e9da645a600b96862e8f Mon Sep 17 00:00:00 2001
From: Alex Branham <[email protected]>
Date: Mon, 26 Feb 2018 10:18:55 -0600
Subject: [PATCH] Refine how we setup flymake backend function

* latex.el: Add LaTeX-flymake to TeX-latex-mode
* latex-flymake.el: Don't add to LaTeX-mode-hook
---
 latex-flymake.el | 7 -------
 latex.el         | 5 ++++-
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/latex-flymake.el b/latex-flymake.el
index b06149cf..2a86ebed 100644
--- a/latex-flymake.el
+++ b/latex-flymake.el
@@ -100,12 +100,5 @@ REPORT-FN is flymake's callback function."
       (process-send-region LaTeX--flymake-proc (point-min) (point-max))
       (process-send-eof LaTeX--flymake-proc))))
 
-(defun LaTeX-setup-flymake-backend ()
-  "Setup flymake backend for LaTeX."
-  (add-hook 'flymake-diagnostic-functions 'LaTeX-flymake nil t))
-
-(when (< 25 emacs-major-version)
-  (add-hook 'LaTeX-mode-hook #'LaTeX-setup-flymake-backend))
-
 (provide 'latex-flymake)
 ;;; latex-flymake.el ends here
diff --git a/latex.el b/latex.el
index 7354c23b..d3c2e65b 100644
--- a/latex.el
+++ b/latex.el
@@ -5901,7 +5901,10 @@ of `LaTeX-mode-hook'."
   ;; Defeat filladapt
   (if (and (boundp 'filladapt-mode)
 	   filladapt-mode)
-      (turn-off-filladapt-mode)))
+      (turn-off-filladapt-mode))
+  (when (< 25 emacs-major-version)
+    ;; Set up flymake backend, see latex-flymake.el
+    (add-hook 'flymake-diagnostic-functions 'LaTeX-flymake nil t)))
 
 (TeX-abbrev-mode-setup doctex-mode)
 
-- 
2.16.2

_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to