bug-auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#30980: [PATCH] add customize option for flymake


From: Arash Esbati
Subject: bug#30980: [PATCH] add customize option for flymake
Date: Mon, 04 Mar 2024 22:47:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Alex Branham <alex.branham@gmail.com> writes:

> 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.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

Hi Alex,

first of all, my sincere apologies that you didn't get any response from
us -- I hope you have the time and energy to pick this up again with me.
I think your addition makes sense and we should install it.  I have some
comments below:

>>From d6ec0bd5db2f5d8097b6d2e784ea3de390ff63f0 Mon Sep 17 00:00:00 2001
> From: Alex Branham <branham@utexas.edu>
> 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.

Did you hit 'C-x 4 a' to generate the logs?  Usually, this part should
look like this:

* latex-flymake.el (LaTeX-flymake-chktex-flags): New option.
  (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.

Here, you should add a @defopt environment describing
`LaTeX-flymake-chktex-flags'.  And while we're at it: Can we rename this
to `LaTeX-flymake-chktex-options'?  So something like:

@defopt LaTeX-flymake-chktex-options
List of strings passed to chktex program as additonal options.
@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,
> 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

This part is already in News in 12.2.

> +The accompanying new customize option @code{LaTeX-flymake-chktex-flags}
> +allows users to turn on/off specific warnings.

This part should go into the NEWS -- slightly rephrased.

> 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.
                                               ^^^^^^^^^ options?

> +You can use this to enable or disable specific warnings by
> +setting it to something like:
> +
> +'(\"-n12\" \"-w41\")

With a recent Emacs, this needs to be:

\\='(\"-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)

Why using backquote when appending?  Or maybe:

:command `("chktex" "--verbosity=0" "--quiet" "--inputfiles"
           ,@LaTeX-flymake-chktex-options)

>          :sentinel
>          (lambda (proc _event)
>            (when (eq 'exit (process-status proc))

Again, sorry for being late.

Best, Arash





reply via email to

[Prev in Thread] Current Thread [Next in Thread]