branch: externals/auctex
commit 91073c6b790aca0d5bf8beb1d2d78f772e526ba7
Author: Arash Esbati <[email protected]>
Commit: Arash Esbati <[email protected]>
Add new custom option `LaTeX-flymake-chktex-options'
* doc/auctex.texi (Checking): Document the new option.
* latex-flymake.el (LaTeX-flymake-chktex-options): New custom
option.
(LaTeX-flymake): Use it. (bug#30980)
---
doc/auctex.texi | 26 ++++++++++++++++----------
latex-flymake.el | 22 ++++++++++++++++++++--
2 files changed, 36 insertions(+), 12 deletions(-)
diff --git a/doc/auctex.texi b/doc/auctex.texi
index dce723a3f8..91b8c40ab9 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -4073,16 +4073,22 @@ buffers by adding this to your init file:
(add-hook 'LaTeX-mode-hook #'flymake-mode)
@end lisp
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,
-allowing you to create your own errors. You may need to install the
-programs before using them. You can get @code{lacheck} from
-URL:@url{https://www.ctan.org/pkg/lacheck} and
-@code{chktex} from
-URL:@url{https://www.ctan.org/pkg/chktex}. @w{@TeX{} Live} contains
-both.
+@code{chktex} as the flymake backend. Error messages produced by
+@code{chktex} can be controlled by setting the variable
+@code{LaTeX-flymake-chktex-options}.
+
+@defopt LaTeX-flymake-chktex-options
+List of strings passed to @code{chktex} program as additonal options.
+This option can be used to pass a specific warning number to @code{chktex}
+like @option{-w41}.
+@end defopt
+
+Each of the two utilities @code{lacheck} and @code{chktex} will find some
+errors the other doesn't, but @code{chktex} is more configurable, allowing
+you to create your own errors. You may need to install the programs
+before using them. You can get @code{lacheck} from
+@url{https://www.ctan.org/pkg/lacheck} and @code{chktex} from
+@url{https://www.ctan.org/pkg/chktex}. @w{@TeX{} Live} contains both.
@node Control
@section Controlling the output
diff --git a/latex-flymake.el b/latex-flymake.el
index 2a86ebed6e..5cffc92412 100644
--- a/latex-flymake.el
+++ b/latex-flymake.el
@@ -1,6 +1,6 @@
;;; latex-flymake.el --- Flymake integration -*- lexical-binding: t; -*-
-;; Copyright (C), 2018 Free Software Foundation, Inc.
+;; Copyright (C), 2018--2024 Free Software Foundation, Inc.
;; Author: Alex Branham <[email protected]>
;; Maintainer: [email protected]
@@ -40,6 +40,23 @@
(defvar-local LaTeX--flymake-proc nil)
+(defcustom LaTeX-flymake-chktex-options nil
+ "A list of strings passed as options 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 :tag "Use chktex defaults" nil)
+ (repeat :tag "Custom chktex options" 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 `("chktex" "--verbosity=0" "--quiet" "--inputfiles"
+ ,@LaTeX-flymake-chktex-options)
:sentinel
(lambda (proc _event)
(when (eq 'exit (process-status proc))