;ELC ;;; Compiled by cyd@localhost on Mon Apr 23 22:20:32 2007 ;;; from file /home/cyd/emacs/lisp/autoinsert.el ;;; in Emacs version 22.0.99 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. (if (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`autoinsert.el' was compiled for Emacs 19.29 or later")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (custom-declare-group 'auto-insert nil "Automatic mode-dependent insertion of text into new files." :prefix "auto-insert-" :group 'files :group 'convenience) #@519 *Controls automatic insertion into newly found empty files. Possible values: nil do nothing t insert if possible 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. 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. (custom-declare-variable 'auto-insert ''not-modified '(#$ . -726) :type '(choice (const :tag "Insert if possible" t) (const :tag "Do nothing" nil) (other :tag "insert if possible, mark as unmodified." not-modified)) :group 'auto-insert) #@113 *Non-nil means ask user before auto-inserting. When this is `function', only ask when called non-interactively. (custom-declare-variable 'auto-insert-query ''function '(#$ . -1488) :type '(choice (const :tag "Don't ask" nil) (const :tag "Ask if called non-interactively" function) (other :tag "Ask" t)) :group 'auto-insert) #@121 *Prompt to use when querying whether to auto-insert. If this contains a %s, that will be replaced by the matching rule. (custom-declare-variable 'auto-insert-prompt '"Perform %s auto-insertion? " '(#$ . -1819) :type 'string :group 'auto-insert) #@687 A list specifying text to insert by default into a new file. Elements look like (CONDITION . ACTION) or ((CONDITION . DESCRIPTION) . ACTION). CONDITION may be a regexp that must match the new file's name, or it may be a symbol that must match the major mode for this element to apply. Only the first matching element is effective. Optional DESCRIPTION is a string for filling `auto-insert-prompt'. ACTION may be a skeleton to insert (see `skeleton-insert'), an absolute file-name or one relative to `auto-insert-directory' or a function to call. ACTION may also be a vector containing several successive single actions as described above, e.g. ["header.insert" date-and-author-update]. (custom-declare-variable 'auto-insert-alist ''((("\\.\\([Hh]\\|hh\\|hpp\\)\\'" . "C / C++ header") (upcase (concat (file-name-nondirectory (substring buffer-file-name 0 (match-beginning 0))) "_" (substring buffer-file-name (1+ (match-beginning 0))))) "#ifndef " str n "#define " str "\n\n" _ "\n\n#endif") (("\\.\\([Cc]\\|cc\\|cpp\\)\\'" . "C / C++ program") nil "#include \"" (let ((stem (file-name-sans-extension buffer-file-name))) (cond ((file-exists-p (concat stem ".h")) (file-name-nondirectory (concat stem ".h"))) ((file-exists-p (concat stem ".hh")) (file-name-nondirectory (concat stem ".hh"))))) & 34 | -10) (("[Mm]akefile\\'" . "Makefile") . "makefile.inc") (html-mode lambda nil (sgml-tag "html")) (plain-tex-mode . "tex-insert.tex") (bibtex-mode . "tex-insert.tex") (latex-mode "options, RET: " "\\documentclass[" str & 93 | -1 123 (read-string "class: ") "}\n" ("package, %s: " "\\usepackage[" (read-string "options, RET: ") & 93 | -1 123 str "}\n") _ "\n\\begin{document}\n" _ "\n\\end{document}") (("/bin/.*[^/]\\'" . "Shell-Script mode magic number") lambda nil (if (eq major-mode default-major-mode) (sh-mode))) (ada-mode . ada-header) (("\\.[1-9]\\'" . "Man page skeleton") "Short description: " ".\\\" Copyright (C), " (substring (current-time-string) -4) " " (getenv "ORGANIZATION") | (progn user-full-name) "\n.\\\" You may distribute this file under the terms of the GNU Free\n.\\\" Documentation License.\n.TH " (file-name-sans-extension (file-name-nondirectory (buffer-file-name))) " " (file-name-extension (buffer-file-name)) " " (format-time-string "%Y-%m-%d ") "\n.SH NAME\n" (file-name-sans-extension (file-name-nondirectory (buffer-file-name))) " \\- " str "\n.SH SYNOPSIS\n.B " (file-name-sans-extension (file-name-nondirectory (buffer-file-name))) "\n" _ "\n.SH DESCRIPTION\n.SH OPTIONS\n.SH FILES\n.SH \"SEE ALSO\"\n.SH BUGS\n.SH AUTHOR\n" (user-full-name) '(if (search-backward "&" (line-beginning-position) t) (replace-match (capitalize (user-login-name)) t t)) '(end-of-line 1) " <" (progn user-mail-address) ">\n") (("\\.el\\'" . "Emacs Lisp header") "Short description: " ";;; " (file-name-nondirectory (buffer-file-name)) " --- " str "\n\n;; Copyright (C) " (substring (current-time-string) -4) " " (getenv "ORGANIZATION") | (progn user-full-name) "\n\n;; Author: " (user-full-name) '(if (search-backward "&" (line-beginning-position) t) (replace-match (capitalize (user-login-name)) t t)) '(end-of-line 1) " <" (progn user-mail-address) ">\n;; Keywords: " '(require 'finder) '(setq v1 (mapcar (lambda (x) (list (symbol-name (car x)))) finder-known-keywords) v2 (mapconcat (lambda (x) (format "%10.0s: %s" (car x) (cdr x))) finder-known-keywords "\n")) ((let ((minibuffer-help-form v2)) (completing-read "Keyword, C-h: " v1 nil t)) str ", ") & -2 "\n\n;; This file is free software; you can redistribute it and/or modify\n;; it under the terms of the GNU General Public License as published by\n;; the Free Software Foundation; either version 2, or (at your option)\n;; any later version.\n\n;; This file is distributed in the hope that it will be useful,\n;; but WITHOUT ANY WARRANTY; without even the implied warranty of\n;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n;; GNU General Public License for more details.\n\n;; You should have received a copy of the GNU General Public License\n;; along with GNU Emacs; see the file COPYING. If not, write to\n;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,\n;; Boston, MA 02110-1301, USA.\n\n;;; Commentary:\n\n;; " _ "\n\n;;; Code:\n\n\n\n(provide '" (file-name-sans-extension (file-name-nondirectory (buffer-file-name))) ")\n;;; " (file-name-nondirectory (buffer-file-name)) " ends here\n")) '(#$ . 2071) :type 'sexp :group 'auto-insert) #@155 *Directory from which auto-inserted files are taken. The value must be an absolute directory name; thus, on a GNU or Unix system, it must end in a slash. (custom-declare-variable 'auto-insert-directory '"~/insert/" '(#$ . -6539) :type 'directory :group 'auto-insert) #@153 Insert default contents into new files if variable `auto-insert' is non-nil. Matches the visited file name against the elements of `auto-insert-alist'. (defalias 'auto-insert #[nil "\204\317 \302=\204\n\203\317o\203\317m\203\317 \306\211\211\211\307b\210\203v@@\211:\204<\202EA@9\203S=\202^\203m\310\"\203m@A\306\211\202(A\211\204+\f\203\275\f;\203\210\311\fP!\202\211\312\203\275\203\250\313=\203\236 \302=\204\254\314\315 \"!\202\251\312\203\275\316\317\320\f!\203\270\f\202\273\321\f!\"\210\322 \203\316 \302=\204\316\323\n\312=!\210-\306\207" [buffer-read-only this-command auto-insert auto-insert-alist action desc nil 1 string-match file-readable-p t function y-or-n-p format mapcar #[(action) ";\203\302 P\211!\205\303!\207\304\213\207" [action auto-insert-directory file-readable-p insert-file-contents ((byte-code "\301p!\210:\203@\302=\204\303!\207 \207" [action switch-to-buffer lambda skeleton-insert] 2))] 3] vectorp vector buffer-modified-p set-buffer-modified-p cond case-fold-search alist major-mode buffer-file-name auto-insert-directory auto-insert-query auto-insert-prompt] 6 (#$ . 6813) nil]) #@210 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. (defalias 'define-auto-insert #[(condition action &optional after) "\305 \"\211\203E\n\306\nA!\2030\307 \205\nA\306\f!\203\"\f\202%\310\f! ?\205,\nA#\202A \203<\310\nA\f\"\202A\310\f\nA\"\241\202Y \203R \fBC\244\202Y\fB B\211)\207" [condition auto-insert-alist elt after action assoc vectorp vconcat vector] 6 (#$ . 8031)]) #@269 Non-nil if Auto-Insert mode is enabled. See the command `auto-insert-mode' for a description of this minor-mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') or call the function `auto-insert-mode'. (custom-declare-variable 'auto-insert-mode 'nil '(#$ . 8589) :set 'custom-set-minor-mode :initialize 'custom-initialize-default :group 'auto-insert :type 'boolean) #@301 Toggle Auto-insert mode. With prefix ARG, turn Auto-insert mode on if and only if ARG is positive. Returns the new status of Auto-insert mode (non-nil means on). When Auto-insert mode is enabled, when new files are created you can insert a template for the file depending on the mode of the buffer. (defalias 'auto-insert-mode #[(&optional arg) "\302=\203 ?\202%\203\303!\304V\202% \204\305\202%\306\307\301\"\210\310\211\2032\311\312\313\"\210\2027\314\312\313\"\210\315\316 \203A\317\202B\320\"\210\321 \203Z\322\301!\210\306\323 \203W\324\202X\325\"\210\326 \210 \207" [arg auto-insert-mode toggle prefix-numeric-value 0 t message "Toggling %s off; better pass an explicit argument." nil add-hook find-file-hook auto-insert remove-hook run-hooks auto-insert-mode-hook auto-insert-mode-on-hook auto-insert-mode-off-hook called-interactively-p customize-mark-as-set "Auto-Insert mode %sabled" "en" "dis" force-mode-line-update] 4 (#$ . 9028) (list (or current-prefix-arg 'toggle))]) (byte-code "\300\301\302\303\304!\205 \304J#\210\305\306!\207" [add-minor-mode auto-insert-mode nil boundp auto-insert-mode-map provide autoinsert] 5)