diff options
Diffstat (limited to 'lisp/autoinsert.el')
-rw-r--r-- | lisp/autoinsert.el | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el index 727e383bb52..29d10bc6295 100644 --- a/lisp/autoinsert.el +++ b/lisp/autoinsert.el @@ -67,7 +67,7 @@ Possible values: other insert if possible, but mark as unmodified. Insertion is possible when something appropriate is found in `auto-insert-alist'. When the insertion is marked as unmodified, you can -save it with \\[write-file] RET. +save it with \\[write-file] \\`RET'. This variable is used when the function `auto-insert' is called, e.g. when you do (add-hook \\='find-file-hook \\='auto-insert). With \\[auto-insert], this is always treated as if it were t." @@ -76,6 +76,9 @@ With \\[auto-insert], this is always treated as if it were t." (other :tag "insert if possible, mark as unmodified." not-modified))) +;;;###autoload +(put 'auto-insert 'safe-local-variable #'null) + (defcustom auto-insert-query 'function "Non-nil means ask user before auto-inserting. When this is `function', only ask when called non-interactively." @@ -89,9 +92,10 @@ If this contains a %s, that will be replaced by the matching rule." :type 'string :version "28.1") +(declare-function sgml-tag "textmodes/sgml-mode" (&optional str arg)) (defcustom auto-insert-alist - '((("\\.\\([Hh]\\|hh\\|hpp\\|hxx\\|h\\+\\+\\)\\'" . "C / C++ header") + `((("\\.\\([Hh]\\|hh\\|hpp\\|hxx\\|h\\+\\+\\)\\'" . "C / C++ header") (replace-regexp-in-string "[^A-Z0-9]" "_" (string-replace @@ -113,7 +117,7 @@ If this contains a %s, that will be replaced by the matching rule." (("[Mm]akefile\\'" . "Makefile") . "makefile.inc") - (html-mode . (lambda () (sgml-tag "html"))) + (html-mode . ,(lambda () (sgml-tag "html"))) (plain-tex-mode . "tex-insert.tex") (bibtex-mode . "tex-insert.tex") @@ -128,9 +132,9 @@ If this contains a %s, that will be replaced by the matching rule." "\n\\end{document}") (("/bin/.*[^/]\\'" . "Shell-Script mode magic number") . - (lambda () - (if (eq major-mode (default-value 'major-mode)) - (sh-mode)))) + ,(lambda () + (if (eq major-mode (default-value 'major-mode)) + (sh-mode)))) (ada-mode . ada-header) @@ -171,7 +175,7 @@ If this contains a %s, that will be replaced by the matching rule." '(setq v1 (let (modes) (mapatoms (lambda (mode) (let ((name (symbol-name mode))) - (when (string-match "-mode$" name) + (when (string-match "-mode\\'" name) (push name modes))))) (sort modes 'string<))) (completing-read "Local variables for mode: " v1 nil t) @@ -210,7 +214,8 @@ If this contains a %s, that will be replaced by the matching rule." "\n")) ((let ((minibuffer-help-form v2)) (completing-read "Keyword, C-h: " v1 nil t)) - str ", ") & -2 " + str ", ") + & -2 " \;; This program is free software; you can redistribute it and/or modify \;; it under the terms of the GNU General Public License as published by @@ -415,6 +420,7 @@ Matches the visited file name against the elements of `auto-insert-alist'." "Associate CONDITION with (additional) ACTION in `auto-insert-alist'. Optional AFTER means to insert action after all existing actions for CONDITION, or if CONDITION had no actions, after all other CONDITIONs." + (declare (indent defun)) (let ((elt (assoc condition auto-insert-alist))) (if elt (setcdr elt |