comparison lisp/packages/autoinsert.el @ 189:489f57a838ef r20-3b21

Import from CVS: tag r20-3b21
author cvs
date Mon, 13 Aug 2007 09:57:07 +0200
parents b9518feda344
children 78478c60bfcd
comparison
equal deleted inserted replaced
188:e29a8e7498d9 189:489f57a838ef
43 ;; Durham, NC 27710 43 ;; Durham, NC 27710
44 ;; (crm@cs.duke.edu,mcnc!duke!crm) 44 ;; (crm@cs.duke.edu,mcnc!duke!crm)
45 45
46 ;;; Code: 46 ;;; Code:
47 47
48 (defvar auto-insert 'not-modified 48 (defgroup auto-insert nil
49 "Automatic mode-dependent insertion of text into new files."
50 :group 'tools)
51
52
53 (defcustom auto-insert 'not-modified
49 "*Controls automatic insertion into newly found empty files: 54 "*Controls automatic insertion into newly found empty files:
50 nil do nothing 55 nil do nothing
51 t insert if possible 56 t insert if possible
52 other insert if possible, but mark as unmodified. 57 other insert if possible, but mark as unmodified.
53 Insertion is possible when something appropriate is found in 58 Insertion is possible when something appropriate is found in
54 `auto-insert-alist'. When the insertion is marked as unmodified, you can 59 `auto-insert-alist'. When the insertion is marked as unmodified, you can
55 save it with \\[write-file] RET. 60 save it with \\[write-file] RET.
56 This variable is used when `auto-insert' is called as a function, e.g. 61 This variable is used when `auto-insert' is called as a function, e.g.
57 when you do (add-hook 'find-file-hooks 'auto-insert). 62 when you do (add-hook 'find-file-hooks 'auto-insert).
58 With \\[auto-insert], this is always treated as if it were `t'.") 63 With \\[auto-insert], this is always treated as if it were `t'."
59 64 :type '(radio (const :tag "Do nothing" nil)
60 65 (const :tag "Insert if possible" t)
61 (defvar auto-insert-query 'function 66 (sexp :format "%t\n"
67 :tag "Insert if possible, but mark as unmodified"
68 other))
69 :require 'autoinsert
70 :group 'auto-insert)
71
72
73 (defcustom auto-insert-query 'function
62 "*If non-`nil', ask user before auto-inserting. 74 "*If non-`nil', ask user before auto-inserting.
63 When this is `function', only ask when called non-interactively.") 75 When this is `function', only ask when called non-interactively."
64 76 :type '(choice (const :tag "Don't ask" nil)
65 77 (const :tag "Ask when non-interactive" function)
66 (defvar auto-insert-prompt "Perform %s auto-insertion? " 78 (sexp :format "%t\n" :tag "Ask" other))
79 :group 'auto-insert)
80
81
82 (defcustom auto-insert-prompt "Perform %s auto-insertion? "
67 "*Prompt to use when querying whether to auto-insert. 83 "*Prompt to use when querying whether to auto-insert.
68 If this contains a %s, that will be replaced by the matching rule.") 84 If this contains a %s, that will be replaced by the matching rule."
85 :type 'string
86 :group 'auto-insert)
69 87
70 88
71 (defvar auto-insert-alist 89 (defvar auto-insert-alist
72 '((("\\.\\([Hh]\\|hh\\|hpp\\)\\'" . "C / C++ header") 90 '((("\\.\\([Hh]\\|hh\\|hpp\\)\\'" . "C / C++ header")
73 (upcase (concat (file-name-nondirectory 91 (upcase (concat (file-name-nondirectory