emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 61fb521: Avoid false indications from Flymake in .d


From: Eli Zaretskii
Subject: [Emacs-diffs] master 61fb521: Avoid false indications from Flymake in .dir-locals.el files
Date: Mon, 21 Oct 2019 07:30:53 -0400 (EDT)

branch: master
commit 61fb5214816ef3d57e676d900e499ffcd079a1f9
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Avoid false indications from Flymake in .dir-locals.el files
    
    * lisp/progmodes/elisp-mode.el (emacs-lisp-mode): Don't install
    'elisp-flymake-checkdoc' and 'elisp-flymake-byte-compile'
    hooks for .dir-locals.el files.  Reported by Clément
    Pit-Claudel <address@hidden>.
---
 lisp/progmodes/elisp-mode.el | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 516e4f9..7705761 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -256,8 +256,20 @@ Blank lines separate paragraphs.  Semicolons start 
comments.
   (setq-local project-vc-external-roots-function #'elisp-load-path-roots)
   (add-hook 'completion-at-point-functions
             #'elisp-completion-at-point nil 'local)
-  (add-hook 'flymake-diagnostic-functions #'elisp-flymake-checkdoc nil t)
-  (add-hook 'flymake-diagnostic-functions #'elisp-flymake-byte-compile nil t))
+  ;; .dir-locals.el and lock files will cause the byte-compiler and
+  ;; checkdoc emit spurious warnings, because they don't follow the
+  ;; conventions of Emacs Lisp sources.  Until we have a better fix,
+  ;; like teaching elisp-mode about files that only hold data
+  ;; structures, we disable the ELisp Flymake backend for these files.
+  (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)))
+    (add-hook 'flymake-diagnostic-functions #'elisp-flymake-checkdoc nil t)
+    (add-hook 'flymake-diagnostic-functions
+              #'elisp-flymake-byte-compile nil t)))
 
 ;; Font-locking support.
 



reply via email to

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