bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#40573: 27.0.90; flymake-mode broken in scratch buffer


From: João Távora
Subject: bug#40573: 27.0.90; flymake-mode broken in scratch buffer
Date: Sun, 12 Apr 2020 14:18:50 +0100

Hi,

Eli, remember when you added this commit?

commit 61fb5214816ef3d57e676d900e499ffcd079a1f9
Author: Eli Zaretskii <eliz@gnu.org>
Date:   Mon Oct 21 14:29:13 2019 +0300

    Avoid false indications from Flymake in .dir-locals.el files

This seems to have the unintended effect of also disabling flymake-mode
in fileless elisp buffers, like *scratch*.  Was it intended? It seems like a
regression in relation to 26.3. The repro is simple:

Emacs -Q
M-x flymake-mode

Works in Emacs 26.3, doesn't in Emacs-27.

Again, without wanting to rehash a long and difficult discussion, I
think the best way to fix the original problem is to make an
emacs-lisp-data-mode and use that mode for .dir-locals.el.

  emacs-lisp-data-mode   ; things related to
           ^             ; emacs-lisp-data, like sexp navigation,
           |             ; comments, etc.  Use for .dir-locals.el
           |
           |
     emacs-lisp-mode     ; things related to data which happens
           ^             ; to also be code. Setup xref, flymake, imenu,
           |             ; etc
           |
           |
  lisp-interaction-mode  ; no change, basically this just has an
                         ; enhanced keymap for for the advanced
                         ; interaction possibilities.

That said, whatever fix we can come up with for this regression is
probably safer for Emacs 27.  I propose this slight convolution of the
condition you added.

diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 2617a6e4cc..f39ecf9b7b 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -264,9 +264,9 @@ emacs-lisp-mode
   (unless
       (let* ((bfname (buffer-file-name))
              (fname (and (stringp bfname) (file-name-nondirectory bfname))))
-        (or (not (stringp fname))
-            (string-match "\\`\\.#" fname)
-            (string-equal dir-locals-file fname)))
+        (and (stringp fname)
+             (or (string-match "\\`\\.#" fname)
+                 (string-equal dir-locals-file fname))))
     (add-hook 'flymake-diagnostic-functions #'elisp-flymake-checkdoc nil t)
     (add-hook 'flymake-diagnostic-functions
               #'elisp-flymake-byte-compile nil t)))

reply via email to

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