diff options
| author | Dave Love | 1998-03-25 19:06:46 +0000 |
|---|---|---|
| committer | Dave Love | 1998-03-25 19:06:46 +0000 |
| commit | 4605a50d81572778508d3f10b4eb4cb9982b6074 (patch) | |
| tree | 027eafa06438f8fd4f25eb120684c6163440b6e4 | |
| parent | ae7460eed6673d40f781e24534c8cd794b4f687e (diff) | |
| download | emacs-4605a50d81572778508d3f10b4eb4cb9982b6074.tar.gz emacs-4605a50d81572778508d3f10b4eb4cb9982b6074.zip | |
(auto-insert, auto-insert-query): :tag choices.
(define-auto-insert): Rename arg key to match doc.
| -rw-r--r-- | lisp/autoinsert.el | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el index be985458c91..1c3786778ef 100644 --- a/lisp/autoinsert.el +++ b/lisp/autoinsert.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; autoinsert.el --- automatic mode-dependent insertion of text into new files | 1 | ;;; autoinsert.el --- automatic mode-dependent insertion of text into new files |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985, 1986, 1987, 1994, 1995 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1985, 86, 87, 94, 95, 98 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Charlie Martin <crm@cs.duke.edu> | 5 | ;; Author: Charlie Martin <crm@cs.duke.edu> |
| 6 | ;; Adapted-By: Daniel.Pfeiffer@Informatik.START.dbp.de, fax (+49 69) 7588-2389 | 6 | ;; Adapted-By: Daniel.Pfeiffer@Informatik.START.dbp.de, fax (+49 69) 7588-2389 |
| @@ -76,13 +76,18 @@ save it with \\[write-file] RET. | |||
| 76 | This variable is used when `auto-insert' is called as a function, e.g. | 76 | This variable is used when `auto-insert' is called as a function, e.g. |
| 77 | when you do (add-hook 'find-file-hooks 'auto-insert). | 77 | when you do (add-hook 'find-file-hooks 'auto-insert). |
| 78 | With \\[auto-insert], this is always treated as if it were `t'." | 78 | With \\[auto-insert], this is always treated as if it were `t'." |
| 79 | :type '(choice (const t) (const nil) (const not-modified)) | 79 | :type '(choice (const :tag "Insert if possible" t) |
| 80 | (const :tag "Do nothing" nil) | ||
| 81 | (const :tag "insert if possible, mark as unmodified." | ||
| 82 | not-modified)) | ||
| 80 | :group 'auto-insert) | 83 | :group 'auto-insert) |
| 81 | 84 | ||
| 82 | (defcustom auto-insert-query 'function | 85 | (defcustom auto-insert-query 'function |
| 83 | "*If non-`nil', ask user before auto-inserting. | 86 | "*If non-`nil', ask user before auto-inserting. |
| 84 | When this is `function', only ask when called non-interactively." | 87 | When this is `function', only ask when called non-interactively." |
| 85 | :type '(choice (const t) (const nil) (const function)) | 88 | :type '(choice (const :tag "Ask" t) |
| 89 | (const :tag "Don't ask" nil) | ||
| 90 | (const :tag "Ask if called non-interactively" function)) | ||
| 86 | :group 'auto-insert) | 91 | :group 'auto-insert) |
| 87 | 92 | ||
| 88 | (defcustom auto-insert-prompt "Perform %s auto-insertion? " | 93 | (defcustom auto-insert-prompt "Perform %s auto-insertion? " |
| @@ -262,11 +267,11 @@ Matches the visited file name against the elements of `auto-insert-alist'." | |||
| 262 | 267 | ||
| 263 | 268 | ||
| 264 | ;;;###autoload | 269 | ;;;###autoload |
| 265 | (defun define-auto-insert (key action &optional after) | 270 | (defun define-auto-insert (condition action &optional after) |
| 266 | "Associate CONDITION with (additional) ACTION in `auto-insert-alist'. | 271 | "Associate CONDITION with (additional) ACTION in `auto-insert-alist'. |
| 267 | Optional AFTER means to insert action after all existing actions for CONDITION, | 272 | Optional AFTER means to insert action after all existing actions for CONDITION, |
| 268 | or if CONDITION had no actions, after all other CONDITIONs." | 273 | or if CONDITION had no actions, after all other CONDITIONs." |
| 269 | (let ((elt (assoc key auto-insert-alist))) | 274 | (let ((elt (assoc condition auto-insert-alist))) |
| 270 | (if elt | 275 | (if elt |
| 271 | (setcdr elt | 276 | (setcdr elt |
| 272 | (if (vectorp (cdr elt)) | 277 | (if (vectorp (cdr elt)) |
| @@ -277,8 +282,8 @@ or if CONDITION had no actions, after all other CONDITIONs." | |||
| 277 | (vector (cdr elt) action) | 282 | (vector (cdr elt) action) |
| 278 | (vector action (cdr elt))))) | 283 | (vector action (cdr elt))))) |
| 279 | (if after | 284 | (if after |
| 280 | (nconc auto-insert-alist (list (cons key action))) | 285 | (nconc auto-insert-alist (list (cons condition action))) |
| 281 | (setq auto-insert-alist (cons (cons key action) | 286 | (setq auto-insert-alist (cons (cons condition action) |
| 282 | auto-insert-alist)))))) | 287 | auto-insert-alist)))))) |
| 283 | 288 | ||
| 284 | ;;;###autoload | 289 | ;;;###autoload |