1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

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 <cpitclaudel@gmail.com>.
This commit is contained in:
Eli Zaretskii 2019-10-21 14:29:13 +03:00
parent 03921902b2
commit 61fb521481

View file

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