• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/

Lines Matching defs:insert

32 ;;  which automatically inserts these files; the idea is to insert
37 ;; (add-hook 'find-file-hook 'auto-insert)
38 ;; setq auto-insert-directory to an appropriate slash-terminated value
40 ;; You can also customize the variable `auto-insert-mode' to load the
42 ;; (auto-insert-mode 1)
54 (defgroup auto-insert nil
56 :prefix "auto-insert-"
61 (defcustom auto-insert 'not-modified
65 t insert if possible
66 other insert if possible, but mark as unmodified.
68 `auto-insert-alist'. When the insertion is marked as unmodified, you can
70 This variable is used when the function `auto-insert' is called, e.g.
71 when you do (add-hook 'find-file-hook 'auto-insert).
72 With \\[auto-insert], this is always treated as if it were t."
75 (other :tag "insert if possible, mark as unmodified."
77 :group 'auto-insert)
79 (defcustom auto-insert-query 'function
85 :group 'auto-insert)
87 (defcustom auto-insert-prompt "Perform %s auto-insertion? "
88 "*Prompt to use when querying whether to auto-insert.
91 :group 'auto-insert)
94 (defcustom auto-insert-alist
118 (plain-tex-mode . "tex-insert.tex")
119 (bibtex-mode . "tex-insert.tex")
216 "A list specifying text to insert by default into a new file.
221 Optional DESCRIPTION is a string for filling `auto-insert-prompt'.
222 ACTION may be a skeleton to insert (see `skeleton-insert'), an absolute
223 file-name or one relative to `auto-insert-directory' or a function to call.
225 described above, e.g. [\"header.insert\" date-and-author-update]."
227 :group 'auto-insert)
230 ;; Establish a default value for auto-insert-directory
231 (defcustom auto-insert-directory "~/insert/"
236 :group 'auto-insert)
240 (defun auto-insert ()
241 "Insert default contents into new files if variable `auto-insert' is non-nil.
242 Matches the visited file name against the elements of `auto-insert-alist'."
245 (or (eq this-command 'auto-insert)
246 (and auto-insert
248 (let ((alist auto-insert-alist)
268 (file-readable-p (concat auto-insert-directory action))
270 (if auto-insert-query
271 (or (if (eq auto-insert-query 'function)
272 (eq this-command 'auto-insert))
273 (y-or-n-p (format auto-insert-prompt desc)))
279 (setq action (concat auto-insert-directory action)))
280 (insert-file-contents action))
287 (skeleton-insert action)
293 (not (eq this-command 'auto-insert))
294 (set-buffer-modified-p (eq auto-insert t)))))
301 (defun define-auto-insert (condition action &optional after)
302 "Associate CONDITION with (additional) ACTION in `auto-insert-alist'.
303 Optional AFTER means to insert action after all existing actions for CONDITION,
305 (let ((elt (assoc condition auto-insert-alist)))
316 (nconc auto-insert-alist (list (cons condition action)))
317 (setq auto-insert-alist (cons (cons condition action)
318 auto-insert-alist))))))
321 (define-minor-mode auto-insert-mode
322 "Toggle Auto-insert mode.
323 With prefix ARG, turn Auto-insert mode on if and only if ARG is positive.
324 Returns the new status of Auto-insert mode (non-nil means on).
326 When Auto-insert mode is enabled, when new files are created you can
327 insert a template for the file depending on the mode of the buffer."
328 :global t :group 'auto-insert
329 (if auto-insert-mode
330 (add-hook 'find-file-hook 'auto-insert)
331 (remove-hook 'find-file-hook 'auto-insert)))