GNU bug report logs - #79380
31.0.50; Flymake does not check Elisp code anymore

Previous Next

Package: emacs;

Reported by: Daniel Mendler <mail <at> daniel-mendler.de>

Date: Wed, 3 Sep 2025 21:31:02 UTC

Severity: normal

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Full log


View this message in rfc822 format

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Daniel Mendler <mail <at> daniel-mendler.de>
Cc: 79380 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: bug#79380: 31.0.50; Flymake does not check Elisp code anymore, [PATCH] Fix null values of elisp-flymake-byte-compile-executable
Date: Fri, 05 Sep 2025 14:26:49 -0400
[Message part 1 (text/plain, inline)]
Spencer Baugh <sbaugh <at> janestreet.com> writes:
> Daniel Mendler <mail <at> daniel-mendler.de> writes:
>
>> Thanks for taking a look at this problem!
>>
>> Spencer Baugh <sbaugh <at> janestreet.com> writes:
>>> On Thu, Sep 4, 2025, 12:03 PM Eli Zaretskii <eliz <at> gnu.org> wrote:
>>>> > From: Spencer Baugh <sbaugh <at> janestreet.com>
>>>> > Date: Thu, 4 Sep 2025 11:45:12 -0400
>>>> > Cc: mail <at> daniel-mendler.de, 79380 <at> debbugs.gnu.org
>>>> >
>>>> >  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.
>>>>
>>>> I don't think this is about conventions.  In this specific case, any
>>>> value that is not a string will signal an error in
>>>> elisp-flymake-byte-compile--executable, exactly like nil did in the
>>>> patch that was installed.  So I think any value that is not a string
>>>> should be handled as nil (in addition to the checking of strings that
>>>> the code already does).
>>>>
>>>
>>> Yes, my suggestion is that signaling an error is good because it shows that
>>> the user's configuration is wrong.
>>
>> I agree that signaling an error would be good. As an alternative you
>> could do it explicitly. Check against nil to use the defaults, check
>> stringp for a user defined path and throw an explicit error in the other
>> cases.
>
> Right, even better.  Like this:

Ping, I'd like to install this patch to fix the breakage on master.

Here's an updated version since Eli separately pushed the fix to the
defcustom.

[0001-Fix-null-values-of-elisp-flymake-byte-compile-execut.patch (text/x-patch, inline)]
From b8028967538aec545b6082bb295229b142490710 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh <at> janestreet.com>
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): Improve defcustom type.
(elisp-flymake-byte-compile--executable): Properly check for
nil. (bug#79380)
---
 lisp/progmodes/elisp-mode.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index aebc93d1ddb..df9af7d83bd 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -2303,13 +2303,16 @@ elisp-flymake-byte-compile--executable
   "Return absolute file name of the Emacs executable for flymake byte-compilation."
   (let ((filename
          (cond
-          ((file-name-absolute-p elisp-flymake-byte-compile-executable)
-           elisp-flymake-byte-compile-executable)
+          ((null elisp-flymake-byte-compile-executable) nil)
           ((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 (file-name-absolute-p elisp-flymake-byte-compile-executable)
+               elisp-flymake-byte-compile-executable
+             (when-let* ((pr (project-current)))
+               (file-name-concat (project-root pr)
+                                 elisp-flymake-byte-compile-executable))))
+          (t (error "Invalid `elisp-flymake-byte-compile-executable': %s"
+                    elisp-flymake-byte-compile-executable)))))
+    (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


This bug report was last modified 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.