Subject: bug#79380: 31.0.50; Flymake does not check Elisp code anymore

From: Spencer Baugh <[email-masked]>
Date: Thu, 4 Sep 2025 11:45:12 -0400

On Thu, Sep 4, 2025, 11:33 AM Eli Zaretskii <[email-masked]> wrote:

> > Cc: [email-masked]
> > Date: Thu, 04 Sep 2025 10:38:32 -0400
> > From:  Spencer Baugh via "Bug reports for GNU Emacs,
> >  the Swiss army knife of text editors" <[email-masked]>
> >
> > Daniel Mendler <[email-masked]> writes:
> > > If elisp-flymake-byte-compile-executable is nil (the default), the
> > > absolute file predicate fails and as a result Flymake does not check
> > > Elisp anymore:
> > >
> > > (file-name-absolute-p elisp-flymake-byte-compile-executable)
> >
> > Apologies, I accidentally posted an old version of the patch which was
> > then installed.  The attached should fix it.  Please try it (and then
> > feel free to push it if it works).
> >
> > >From 425e3f4ab95faf7c0e4a749e0c428f4c05f32cfa Mon Sep 17 00:00:00 2001
> > From: Spencer Baugh <[email-masked]>
> > Date: Thu, 4 Sep 2025 10:36:17 -0400
> > Subject: [PATCH] Fix null values of elisp-flymake-byte-compile-executable
> >
> > * lisp/progmodes/elisp-mode.el
> > (elisp-flymake-byte-compile--executable): Properly check for
> > nil. (bug#79380)
> > ---
> >  lisp/progmodes/elisp-mode.el | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
> > index e8344852829..c6951810c3e 100644
> > --- a/lisp/progmodes/elisp-mode.el
> > +++ b/lisp/progmodes/elisp-mode.el
> > @@ -2301,13 +2301,14 @@ elisp-flymake-byte-compile--executable
> >    "Return absolute file name of the Emacs executable for flymake
> byte-compilation."
> >    (let ((filename
> >           (cond
> > +          ((null elisp-flymake-byte-compile-executable) nil)
> >            ((file-name-absolute-p elisp-flymake-byte-compile-executable)
> >             elisp-flymake-byte-compile-executable)
> >            ((stringp elisp-flymake-byte-compile-executable)
> >             (when-let* ((pr (project-current)))
> >               (file-name-concat (project-root pr)
> >
>  elisp-flymake-byte-compile-executable))))))
> > -    (if (file-executable-p filename)
> > +    (if (and filename (file-executable-p filename))
> >          filename
> >        (when elisp-flymake-byte-compile-executable
> >          (message "No such `elisp-flymake-byte-compile-executable': %s"
> > --
> > 2.43.7
>
> Shouldn't the tests of the value of the user option use stringp
> instead of null?
>

Is that the convention?  I always feel like it's better to test for null
explicitly, so that if the user sets the variable to a symbol or list or
something they get an error which can help them track down their mistake.