Hello -

This patch lets users set the flags that chktex uses. It also moves the
documentation of the addition of flymake support into a new section in
changes.texi (I didn't realize 12.1 had already been released when I
added it earlier).

Let me know if anything looks wrong.
Alex

------------------------------------------------------------

>From d6ec0bd5db2f5d8097b6d2e784ea3de390ff63f0 Mon Sep 17 00:00:00 2001
From: Alex Branham <[email protected]>
Date: Wed, 28 Mar 2018 17:23:38 -0500
Subject: [PATCH] New customize option LaTeX-flymake-chktex-flags

* latex-flymake.el (LaTeX-flymake-chktex-flags): New option.
* latex-flymake.el (LaTeX-flymake): Use it.
* doc/auctex.texi:
* doc/changes.texi: Document new option.
---
 doc/auctex.texi  |  5 +++--
 doc/changes.texi | 23 +++++++++++++++--------
 latex-flymake.el | 20 +++++++++++++++++++-
 3 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/doc/auctex.texi b/doc/auctex.texi
index e861a752..9757f746 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -3854,8 +3854,9 @@ buffers by adding this to your init file:
 @lisp
 (add-hook 'LaTeX-mode-hook #'flymake-mode)
 @end lisp
-Note that @AUCTeX{} currently only provides support for using
-@code{chktex} as the flymake backend.
+You can customize @code{LaTeX-flymake-chktex-flags} to enable or disable
+chktex warnings. Note that @AUCTeX{} currently only provides support for
+using @code{chktex} as the flymake backend.

 Each of the two utilities @code{lacheck} and @code{chktex} will find
 some errors the other doesn't, but @code{chktex} is more configurable,
diff --git a/doc/changes.texi b/doc/changes.texi
index bddec6a1..3e84f3c8 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -8,6 +8,21 @@

 @end ifset

+@heading News in DEVELOP
+
+@itemize @bullet
+@item
+@AUCTeX{} has support for the Flymake package in Emacs 26 or newer.  To
+enable, call @kbd{M-x flymake-mode RET} or add this to your
+@file{.emacs} file:
+@lisp
+(add-hook 'LaTeX-mode-hook #'flymake-mode)
+@end lisp
+The accompanying new customize option @code{LaTeX-flymake-chktex-flags}
+allows users to turn on/off specific warnings.
+
+@end itemize
+
 @heading News in 12.1

 @itemize @bullet
@@ -19,14 +34,6 @@ been dropped.
 Besides the change in the supported version of Emacs, there has been no
 functional change in this release, which is equivalent to version 11.92.

-@item
-@AUCTeX{} has support for the Flymake package in Emacs 26 or newer.  To
-enable, call @kbd{M-x flymake-mode RET} or add this to your
-@file{.emacs} file:
-@lisp
-(add-hook 'LaTeX-mode-hook #'flymake-mode)
-@end lisp
-
 @end itemize

 @heading News in 11.92
diff --git a/latex-flymake.el b/latex-flymake.el
index 2a86ebed..40bc3052 100644
--- a/latex-flymake.el
+++ b/latex-flymake.el
@@ -40,6 +40,23 @@

 (defvar-local LaTeX--flymake-proc nil)

+(defcustom LaTeX-flymake-chktex-flags nil
+  "If non-nil, a list of strings to pass as arguments to the chktex backend.
+You can use this to enable or disable specific warnings by
+setting it to something like:
+
+'(\"-n12\" \"-w41\")
+
+Which would disable warning 12 (\"interword spacing should
+perhaps be used\") and enable 41 (\"you ought not to use
+primitive TeX in LaTeX code\").
+
+See the chktex manual for warning numbers and details about how
+to use flags."
+  :type '(choice (const nil :tag "Use chktex defaults")
+                 (repeat string))
+  :group 'LaTeX)
+
 (defun LaTeX-flymake (report-fn &rest _args)
   "Setup flymake integration.

@@ -56,7 +73,8 @@ REPORT-FN is flymake's callback function."
        (make-process
         :name "LaTeX-flymake" :noquery t :connection-type 'pipe
         :buffer (generate-new-buffer " *LaTeX-flymake*")
-        :command '("chktex" "--verbosity=0" "--quiet" "--inputfiles")
+        :command (append `("chktex" "--verbosity=0" "--quiet" "--inputfiles")
+                         LaTeX-flymake-chktex-flags)
         :sentinel
         (lambda (proc _event)
           (when (eq 'exit (process-status proc))
--
2.16.3




>From d6ec0bd5db2f5d8097b6d2e784ea3de390ff63f0 Mon Sep 17 00:00:00 2001
From: Alex Branham <[email protected]>
Date: Wed, 28 Mar 2018 17:23:38 -0500
Subject: [PATCH] New customize option LaTeX-flymake-chktex-flags

* latex-flymake.el (LaTeX-flymake-chktex-flags): New option.
* latex-flymake.el (LaTeX-flymake): Use it.
* doc/auctex.texi:
* doc/changes.texi: Document new option.
---
 doc/auctex.texi  |  5 +++--
 doc/changes.texi | 23 +++++++++++++++--------
 latex-flymake.el | 20 +++++++++++++++++++-
 3 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/doc/auctex.texi b/doc/auctex.texi
index e861a752..9757f746 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -3854,8 +3854,9 @@ buffers by adding this to your init file:
 @lisp
 (add-hook 'LaTeX-mode-hook #'flymake-mode)
 @end lisp
-Note that @AUCTeX{} currently only provides support for using
-@code{chktex} as the flymake backend.
+You can customize @code{LaTeX-flymake-chktex-flags} to enable or disable
+chktex warnings. Note that @AUCTeX{} currently only provides support for
+using @code{chktex} as the flymake backend.
 
 Each of the two utilities @code{lacheck} and @code{chktex} will find
 some errors the other doesn't, but @code{chktex} is more configurable,
diff --git a/doc/changes.texi b/doc/changes.texi
index bddec6a1..3e84f3c8 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -8,6 +8,21 @@
 
 @end ifset
 
+@heading News in DEVELOP
+
+@itemize @bullet
+@item
+@AUCTeX{} has support for the Flymake package in Emacs 26 or newer.  To
+enable, call @kbd{M-x flymake-mode RET} or add this to your
+@file{.emacs} file:
+@lisp
+(add-hook 'LaTeX-mode-hook #'flymake-mode)
+@end lisp
+The accompanying new customize option @code{LaTeX-flymake-chktex-flags}
+allows users to turn on/off specific warnings.
+
+@end itemize
+
 @heading News in 12.1
 
 @itemize @bullet
@@ -19,14 +34,6 @@ been dropped.
 Besides the change in the supported version of Emacs, there has been no
 functional change in this release, which is equivalent to version 11.92.
 
-@item
-@AUCTeX{} has support for the Flymake package in Emacs 26 or newer.  To
-enable, call @kbd{M-x flymake-mode RET} or add this to your
-@file{.emacs} file:
-@lisp
-(add-hook 'LaTeX-mode-hook #'flymake-mode)
-@end lisp
-
 @end itemize
 
 @heading News in 11.92
diff --git a/latex-flymake.el b/latex-flymake.el
index 2a86ebed..40bc3052 100644
--- a/latex-flymake.el
+++ b/latex-flymake.el
@@ -40,6 +40,23 @@
 
 (defvar-local LaTeX--flymake-proc nil)
 
+(defcustom LaTeX-flymake-chktex-flags nil
+  "If non-nil, a list of strings to pass as arguments to the chktex backend.
+You can use this to enable or disable specific warnings by
+setting it to something like:
+
+'(\"-n12\" \"-w41\")
+
+Which would disable warning 12 (\"interword spacing should
+perhaps be used\") and enable 41 (\"you ought not to use
+primitive TeX in LaTeX code\").
+
+See the chktex manual for warning numbers and details about how
+to use flags."
+  :type '(choice (const nil :tag "Use chktex defaults")
+                 (repeat string))
+  :group 'LaTeX)
+
 (defun LaTeX-flymake (report-fn &rest _args)
   "Setup flymake integration.
 
@@ -56,7 +73,8 @@ REPORT-FN is flymake's callback function."
        (make-process
         :name "LaTeX-flymake" :noquery t :connection-type 'pipe
         :buffer (generate-new-buffer " *LaTeX-flymake*")
-        :command '("chktex" "--verbosity=0" "--quiet" "--inputfiles")
+        :command (append `("chktex" "--verbosity=0" "--quiet" "--inputfiles")
+                         LaTeX-flymake-chktex-flags)
         :sentinel
         (lambda (proc _event)
           (when (eq 'exit (process-status proc))
-- 
2.16.3

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

Reply via email to