From 9fec681101f27ec578cd25fa11fc737641b8dd91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Pit-Claudel?=
Date: Wed, 16 Oct 2019 22:02:49 -0400 Subject: [PATCH] Add a separate mode for .dir-locals.el files * lisp/progmodes/elisp-mode.el (dir-locals-mode): New mode; disable Flymake in it * lisp/files.el (auto-mode-alist): Use it to open .dir-locals.el --- lisp/files.el | 1 + lisp/progmodes/elisp-mode.el | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lisp/files.el b/lisp/files.el index 4b364b49d8..2f6d63ba1e 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2657,6 +2657,7 @@ auto-mode-alist ("\\.ltx\\'" . latex-mode) ("\\.dtx\\'" . doctex-mode) ("\\.org\\'" . org-mode) + ("\\`\\.dir-locals\\(?:-2\\)?.el\\'" . dir-locals-mode) ("\\.el\\'" . emacs-lisp-mode) ("Project\\.ede\\'" . emacs-lisp-mode) ("\\.\\(scm\\|stk\\|ss\\|sch\\)\\'" . scheme-mode) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 516e4f9cd6..fb704c7de0 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -259,6 +259,14 @@ emacs-lisp-mode (add-hook 'flymake-diagnostic-functions #'elisp-flymake-checkdoc nil t) (add-hook 'flymake-diagnostic-functions #'elisp-flymake-byte-compile nil t)) +;;;###autoload +(define-derived-mode dir-locals-mode emacs-lisp-mode "Directory locals" + "Major mode to edit .dir-locals.el files. + +\\{dir-locals-mode-map}" + (remove-hook 'flymake-diagnostic-functions #'elisp-flymake-checkdoc t) + (remove-hook 'flymake-diagnostic-functions #'elisp-flymake-byte-compile t)) + ;; Font-locking support. (defun elisp--font-lock-flush-elisp-buffers (&optional file) -- 2.17.1