From: Stefan Kangas <stefan@marxist.se>
To: 37878@debbugs.gnu.org
Subject: bug#37878: [PATCH] Add auto-insert skeleton for ".dir-locals.el"
Date: Wed, 23 Oct 2019 01:04:15 +0200 [thread overview]
Message-ID: <CADwFkmmVhD6tk0M0iTzAiq9PwNAp2nLs1MjQmhvT0tnDs-rtNQ@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 610 bytes --]
Steps to reproduce:
0. emacs -Q
1. M-x auto-insert-mode
2. C-x C-f .dir-locals.el RET
Result: The entire Emacs standard header gets inserted into the
buffer, complete with author, copyright notice, provide-statement,
etc.
Expected result: Either don't insert anything or use a custom skeleton.
Please find attached a proposed patch, which adds a skeleton for
"dir-locals.el" to auto-insert-alist. I believe it would make it
easier for especially beginning Emacs users to use ".dir-locals.el".
(Open the file, type M-x auto-insert, and voilá.)
Any comments?
Best regards,
Stefan Kangas
[-- Attachment #2: 0001-Add-auto-insert-skeleton-for-.dir-locals.el.patch --]
[-- Type: application/octet-stream, Size: 2080 bytes --]
From 2606dfc64c4a02edd6dee34aaa5a2db0d2e8713e Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Wed, 23 Oct 2019 00:53:25 +0200
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 b8c2bfd606..f2ac907153 100644
--- a/lisp/autoinsert.el
+++ b/lisp/autoinsert.el
@@ -162,6 +162,29 @@ auto-insert-alist
(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 @@ auto-insert-alist
;; 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.23.0
next reply other threads:[~2019-10-22 23:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 23:04 Stefan Kangas [this message]
2019-10-23 21:19 ` bug#37878: [PATCH] Add auto-insert skeleton for ".dir-locals.el" Juri Linkov
2019-11-02 3:30 ` Stefan Kangas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADwFkmmVhD6tk0M0iTzAiq9PwNAp2nLs1MjQmhvT0tnDs-rtNQ@mail.gmail.com \
--to=stefan@marxist.se \
--cc=37878@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.