From 6c82aafcc04b4948f5dea5ec040880bba7228cc5 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 2 Nov 2019 04:23:24 +0100 Subject: [PATCH] Add auto-insert skeleton for ".dir-locals.el" * lisp/autoinsert.el (auto-insert-alist): Add auto-insert skeleton for ".dir-locals.el". --- lisp/autoinsert.el | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el index b8c2bfd6068..f2ac9071530 100644 --- a/lisp/autoinsert.el +++ b/lisp/autoinsert.el @@ -162,6 +162,29 @@ If this contains a %s, that will be replaced by the matching rule." (replace-match (capitalize (user-login-name)) t t)) '(end-of-line 1) " <" (progn user-mail-address) ">\n") + (".dir-locals.el" + nil + ";;; Directory Local Variables\n" + ";;; For more information see (info \"(emacs) Directory Variables\")\n\n" + "((" + '(setq v1 (let (modes) + (mapatoms (lambda (mode) + (let ((name (symbol-name mode))) + (when (string-match "-mode$" name) + (add-to-list 'modes name))))) + (sort modes 'string<))) + (completing-read "Local variables for mode: " v1 nil t) + " . ((" + (let ((all-variables + (apropos-internal ".*" + (lambda (symbol) + (and (boundp symbol) + (get symbol 'variable-documentation)))))) + (completing-read "Variable to set: " all-variables)) + " . " + (completing-read "Value to set it to: " nil) + "))))\n") + (("\\.el\\'" . "Emacs Lisp header") "Short description: " ";;; " (file-name-nondirectory (buffer-file-name)) " --- " str @@ -315,7 +338,7 @@ described above, e.g. [\"header.insert\" date-and-author-update]." ;; There's no custom equivalent of "repeat" for vectors. :value-type (choice file function (sexp :tag "Skeleton or vector"))) - :version "25.1") + :version "27.1") ;; Establish a default value for auto-insert-directory -- 2.39.5