diff options
| author | Dave Love | 1999-10-23 18:18:03 +0000 |
|---|---|---|
| committer | Dave Love | 1999-10-23 18:18:03 +0000 |
| commit | af372af632bb21749e858350200e13b3e9c10057 (patch) | |
| tree | 3c497c15c65802c9657ebc6c7833c50685620ca2 | |
| parent | 6bfff0646b32006bed96d41bba6de0596263d93d (diff) | |
| download | emacs-af372af632bb21749e858350200e13b3e9c10057.tar.gz emacs-af372af632bb21749e858350200e13b3e9c10057.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/elide-head.el | 116 | ||||
| -rw-r--r-- | man/ChangeLog | 6 | ||||
| -rw-r--r-- | man/autotype.texi | 277 |
4 files changed, 358 insertions, 45 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8402bea63d2..4880d20a68a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 1999-10-23 Dave Love <fx@gnu.org> | ||
| 2 | |||
| 3 | * elide-head.el: New file. | ||
| 4 | |||
| 1 | 1999-10-23 Gerd Moellmann <gerd@gnu.org> | 5 | 1999-10-23 Gerd Moellmann <gerd@gnu.org> |
| 2 | 6 | ||
| 3 | * Makefile (compile-files, backup-compiled-files): New targets. | 7 | * Makefile (compile-files, backup-compiled-files): New targets. |
diff --git a/lisp/elide-head.el b/lisp/elide-head.el new file mode 100644 index 00000000000..db26eb8f9ea --- /dev/null +++ b/lisp/elide-head.el | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | ;;; elid-head.el --- hide headers in files | ||
| 2 | |||
| 3 | ;; Copyright (C) 1999 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Dave Love <fx@gnu.org> | ||
| 6 | ;; Keywords: outlines tools | ||
| 7 | |||
| 8 | ;; This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | ;; GNU Emacs is free software; you can redistribute it and/or modify | ||
| 11 | ;; it under the terms of the GNU General Public License as published by | ||
| 12 | ;; the Free Software Foundation; either version 2, or (at your option) | ||
| 13 | ;; any later version. | ||
| 14 | |||
| 15 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | ;; GNU General Public License for more details. | ||
| 19 | |||
| 20 | ;; You should have received a copy of the GNU General Public License | ||
| 21 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| 22 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 23 | ;; Boston, MA 02111-1307, USA. | ||
| 24 | |||
| 25 | ;;; Commentary: | ||
| 26 | |||
| 27 | ;; Functionality for eliding boilerplate text (normally copyright | ||
| 28 | ;; notices) in file headers to avoid clutter when you know what it | ||
| 29 | ;; says. | ||
| 30 | ;; | ||
| 31 | ;; `elide-head-headers-to-hide' controls what is elided by the command | ||
| 32 | ;; `elide-head'. A buffer-local invisible overlay manages the | ||
| 33 | ;; elision. | ||
| 34 | |||
| 35 | ;; Please don't turn this on in site init files so that information | ||
| 36 | ;; isn't hidden from users who may not know what it says. | ||
| 37 | |||
| 38 | ;; Inspired by jwz's hide-copyleft.el, for which we don't have an | ||
| 39 | ;; assignment. | ||
| 40 | |||
| 41 | ;;; Code: | ||
| 42 | |||
| 43 | (defgroup elide-head nil | ||
| 44 | "Eliding copyright headers and the like in source files." | ||
| 45 | :prefix "elide-head" | ||
| 46 | :group 'tools) | ||
| 47 | |||
| 48 | (defcustom elide-head-headers-to-hide | ||
| 49 | '(("is free software; you can redistribute it" . ; GNU boilerplate | ||
| 50 | "Boston, MA 02111-1307, USA\\.") | ||
| 51 | ("The Regents of the University of California\\. All rights reserved\\." . | ||
| 52 | "SUCH DAMAGE\\.") ; BSD | ||
| 53 | ("Permission is hereby granted, free of charge" . ; X11 | ||
| 54 | "authorization from the X Consortium\\.")) | ||
| 55 | "Alist of regexps defining start end end of text to elide. | ||
| 56 | |||
| 57 | The cars of elements of the list are searched for in order. Text is | ||
| 58 | elided with an invisible overlay from the end of the line where the | ||
| 59 | first match is found to the end of the match for the corresponding | ||
| 60 | cdr." | ||
| 61 | :group 'elide-head | ||
| 62 | :type '(alist :key-type (string :tag "Start regexp") | ||
| 63 | :value-type (string :tag "End regexp"))) | ||
| 64 | |||
| 65 | (defvar elide-head-overlay nil) | ||
| 66 | (make-variable-buffer-local 'elide-head-overlay) | ||
| 67 | |||
| 68 | ;;;###autoload | ||
| 69 | (defun elide-head (&optional arg) | ||
| 70 | "Hide header material in buffer according to `elide-head-headers-to-hide'. | ||
| 71 | |||
| 72 | The header is made invisible with an overlay. With a prefix arg, show | ||
| 73 | an elided material again. | ||
| 74 | |||
| 75 | This is suitable as an entry on `find-file-hooks' or appropriate mode hooks." | ||
| 76 | (interactive "P") | ||
| 77 | (if arg | ||
| 78 | (elide-head-show) | ||
| 79 | (save-excursion | ||
| 80 | (save-restriction | ||
| 81 | (let ((rest elide-head-headers-to-hide) | ||
| 82 | beg end) | ||
| 83 | (widen) | ||
| 84 | (goto-char (point-min)) | ||
| 85 | (while rest | ||
| 86 | (save-excursion | ||
| 87 | (when (re-search-forward (caar rest) nil t) | ||
| 88 | (setq beg (point)) | ||
| 89 | (when (re-search-forward (cdar rest) nil t) | ||
| 90 | (setq end (point) | ||
| 91 | rest nil)))) | ||
| 92 | (if rest (setq rest (cdr rest)))) | ||
| 93 | (if (not (and beg end)) | ||
| 94 | (if (interactive-p) | ||
| 95 | (error "No header found")) | ||
| 96 | (goto-char beg) | ||
| 97 | (end-of-line) | ||
| 98 | (if (overlayp elide-head-overlay) | ||
| 99 | (move-overlay elide-head-overlay (point) end) | ||
| 100 | (setq elide-head-overlay (make-overlay (point) end))) | ||
| 101 | (overlay-put elide-head-overlay 'invisible t) | ||
| 102 | (overlay-put elide-head-overlay 'intangible t) | ||
| 103 | (overlay-put elide-head-overlay 'after-string "..."))))))) | ||
| 104 | |||
| 105 | (defun elide-head-show () | ||
| 106 | "Show a header elided current buffer by \\[elide-head]." | ||
| 107 | (interactive) | ||
| 108 | (if (and (overlayp elide-head-overlay) | ||
| 109 | (overlay-buffer elide-head-overlay)) | ||
| 110 | (delete-overlay elide-head-overlay) | ||
| 111 | (if (interactive-p) | ||
| 112 | (error "No header hidden")))) | ||
| 113 | |||
| 114 | (provide 'elide-head) | ||
| 115 | |||
| 116 | ;;; elide-head.el ends here | ||
diff --git a/man/ChangeLog b/man/ChangeLog index 82c431dcc5e..3d1013785e3 100644 --- a/man/ChangeLog +++ b/man/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 1999-10-23 Dave Love <fx@gnu.org> | ||
| 2 | |||
| 3 | * autotype.texi: New file. | ||
| 4 | |||
| 5 | * Makefile.in: Use it. | ||
| 6 | |||
| 1 | 1999-10-23 Paul Eggert <eggert@twinsun.com> | 7 | 1999-10-23 Paul Eggert <eggert@twinsun.com> |
| 2 | 8 | ||
| 3 | * mule.texi, cmdargs.texi: | 9 | * mule.texi, cmdargs.texi: |
diff --git a/man/autotype.texi b/man/autotype.texi index 4a6574dc547..ad1bfd9a9f1 100644 --- a/man/autotype.texi +++ b/man/autotype.texi | |||
| @@ -1,12 +1,15 @@ | |||
| 1 | @c This is part of the Emacs manual. | 1 | \input texinfo |
| 2 | @c This is an annex of the Emacs manual. | ||
| 2 | @c Copyright (C) 1994, 1995 Free Software Foundation, Inc. | 3 | @c Copyright (C) 1994, 1995 Free Software Foundation, Inc. |
| 3 | @c Author: Daniel.Pfeiffer@Informatik.START.dbp.de, fax (+49 69) 7588-2389 | 4 | @c Author: Daniel.Pfeiffer@Informatik.START.dbp.de, fax (+49 69) 7588-2389 |
| 4 | @c See file emacs.texi for copying conditions. | 5 | @c See file emacs.texi for copying conditions. |
| 5 | @node Autotypist, Picture, Abbrevs, Top | 6 | @setfilename ../info/autotype |
| 6 | @chapter Features for Automatic Typing | 7 | @c @node Autotypist, Picture, Abbrevs, Top |
| 7 | @cindex text | 8 | @c @chapter Features for Automatic Typing |
| 8 | @cindex selfinserting text | 9 | @settitle Features for Automatic Typing |
| 9 | @cindex autotypist | 10 | @c @cindex text |
| 11 | @c @cindex selfinserting text | ||
| 12 | @c @cindex autotypist | ||
| 10 | 13 | ||
| 11 | @dircategory Editors | 14 | @dircategory Editors |
| 12 | @direntry | 15 | @direntry |
| @@ -14,11 +17,36 @@ | |||
| 14 | in Emacs. | 17 | in Emacs. |
| 15 | @end direntry | 18 | @end direntry |
| 16 | 19 | ||
| 20 | @ifinfo | ||
| 21 | Copyright @copyright{} 1994, 1995, 1999 Free Software Foundation, Inc. | ||
| 22 | @end ifinfo | ||
| 23 | |||
| 24 | |||
| 25 | @titlepage | ||
| 26 | @sp 10 | ||
| 27 | |||
| 28 | @center @titlefont{Autotyping} | ||
| 29 | @sp 2 | ||
| 30 | @center @subtitlefont{Convenient features for text that you enter | ||
| 31 | frequently in Emacs} | ||
| 32 | @sp 2 | ||
| 33 | @center Daniel Pfeiffer | ||
| 34 | @center additions by Dave Love | ||
| 35 | |||
| 36 | @page | ||
| 37 | @vskip 0pt plus 1filll | ||
| 38 | Copyright @copyright{} 1994, 1995, 1999 Free Software Foundation, Inc. | ||
| 39 | @end titlepage | ||
| 40 | |||
| 41 | @node Top | ||
| 42 | @top Autotyping | ||
| 43 | |||
| 17 | Under certain circumstances you will find yourself typing similar things | 44 | Under certain circumstances you will find yourself typing similar things |
| 18 | over and over again. This is especially true of form letters and programming | 45 | over and over again. This is especially true of form letters and programming |
| 19 | language constructs. Project-specific header comments, flow-control | 46 | language constructs. Project-specific header comments, flow-control |
| 20 | constructs or magic numbers are essentially the same every time. Emacs has | 47 | constructs or magic numbers are essentially the same every time. Emacs has |
| 21 | various features for doing tedious and repetitive typing chores for you. | 48 | various features for doing tedious and repetitive typing chores for you |
| 49 | in addition to the Abbrev features (@pxref{(emacs)Abbrevs}). | ||
| 22 | 50 | ||
| 23 | One solution is using skeletons, flexible rules that say what to | 51 | One solution is using skeletons, flexible rules that say what to |
| 24 | insert, and how to do it. Various programming language modes offer some | 52 | insert, and how to do it. Various programming language modes offer some |
| @@ -30,23 +58,38 @@ depending on the file-name or the mode as appropriate. You can have a file or | |||
| 30 | a skeleton inserted, or you can call a function. Then there is the | 58 | a skeleton inserted, or you can call a function. Then there is the |
| 31 | possibility to have Un*x interpreter scripts automatically take on a magic | 59 | possibility to have Un*x interpreter scripts automatically take on a magic |
| 32 | number and be executable as soon as they are saved. Or you can have a | 60 | number and be executable as soon as they are saved. Or you can have a |
| 33 | copyright notice's year updated, if necessary, every time you save a file. | 61 | copyright notice's year updated, if necessary, every time you save a |
| 62 | file. Similarly for time stamps in the file. | ||
| 63 | |||
| 64 | URLs can be inserted based on a word at point. Flexible templates can | ||
| 65 | be defined for inserting and navigating between text more generally. A | ||
| 66 | sort of meta-expansion facility can be used to try a set of alternative | ||
| 67 | completions and expansions of text at point. | ||
| 34 | 68 | ||
| 35 | @menu | 69 | @menu |
| 36 | * Using Skeletons:: How to insert a skeleton into your text. | 70 | * Using Skeletons:: How to insert a skeleton into your text. |
| 37 | * Wrapping Skeletons:: Putting existing text within a skeleton. | 71 | * Wrapping Skeletons:: Putting existing text within a skeleton. |
| 38 | * Skeletons as Abbrevs:: An alternative for issuing skeleton commands. | 72 | * Skeletons as Abbrevs:: An alternative for issuing skeleton commands. |
| 39 | * Skeleton Language:: Making skeleton commands insert what you want. | 73 | * Skeleton Language:: Making skeleton commands insert what you want. |
| 40 | * Inserting Pairs:: Typing one character and getting another after point. | 74 | * Inserting Pairs:: Typing one character and getting another |
| 75 | after point. | ||
| 41 | * Autoinserting:: Filling up empty files as soon as you visit them. | 76 | * Autoinserting:: Filling up empty files as soon as you visit them. |
| 42 | * Copyrights:: Inserting and updating copyrights. | 77 | * Copyrights:: Inserting and updating copyrights. |
| 43 | * Executables:: Turning interpreter scripts into executables. | 78 | * Executables:: Turning interpreter scripts into executables. |
| 79 | * Timestamps:: Updating dates and times in modified files. | ||
| 80 | * QuickURL:: Inserting URLs based on text at point. | ||
| 81 | * Tempo:: Flexible template insertion. | ||
| 82 | * Hippie Expand:: Expansion of text trying various methods. | ||
| 83 | |||
| 84 | * Concept Index:: | ||
| 85 | * Command Index:: | ||
| 86 | * Variable Index:: | ||
| 44 | @end menu | 87 | @end menu |
| 45 | 88 | ||
| 46 | 89 | ||
| 47 | 90 | ||
| 48 | @node Using Skeletons | 91 | @node Using Skeletons |
| 49 | @section Using Skeletons | 92 | @chapter Using Skeletons |
| 50 | @cindex skeletons | 93 | @cindex skeletons |
| 51 | @cindex using skeletons | 94 | @cindex using skeletons |
| 52 | 95 | ||
| @@ -54,9 +97,10 @@ copyright notice's year updated, if necessary, every time you save a file. | |||
| 54 | programming language you are using, skeletons are a means of accomplishing | 97 | programming language you are using, skeletons are a means of accomplishing |
| 55 | this. Normally skeletons each have a command of their own, that, when called, | 98 | this. Normally skeletons each have a command of their own, that, when called, |
| 56 | will insert the skeleton. These commands can be issued in the usual ways | 99 | will insert the skeleton. These commands can be issued in the usual ways |
| 57 | (@xref{Commands}). Modes that offer various skeletons will often bind these | 100 | (@xref{(emacs)Commands}). Modes that offer various skeletons will often |
| 58 | to key-sequences on the @kbd{C-c} prefix, as well as having an @cite{Insert} | 101 | bind these to key-sequences on the @kbd{C-c} prefix, as well as having |
| 59 | menu and maybe even predefined abbrevs for them (@xref{Skeletons as Abbrevs}). | 102 | an @cite{Insert} menu and maybe even predefined abbrevs for them |
| 103 | (@xref{Skeletons as Abbrevs}). | ||
| 60 | 104 | ||
| 61 | The simplest kind of skeleton will simply insert some text indented | 105 | The simplest kind of skeleton will simply insert some text indented |
| 62 | according to the major mode and leave the cursor at a likely place in the | 106 | according to the major mode and leave the cursor at a likely place in the |
| @@ -75,7 +119,7 @@ termination still gets inserted. | |||
| 75 | 119 | ||
| 76 | 120 | ||
| 77 | @node Wrapping Skeletons | 121 | @node Wrapping Skeletons |
| 78 | @section Wrapping Skeletons Around Existing Test | 122 | @chapter Wrapping Skeletons Around Existing Text |
| 79 | @cindex wrapping skeletons | 123 | @cindex wrapping skeletons |
| 80 | 124 | ||
| 81 | Often you will find yourself with some code that for whatever reason | 125 | Often you will find yourself with some code that for whatever reason |
| @@ -85,18 +129,18 @@ accomplishing this, and can even, in the case of programming languages, | |||
| 85 | reindent the wrapped code for you. | 129 | reindent the wrapped code for you. |
| 86 | 130 | ||
| 87 | Skeleton commands take an optional numeric prefix argument | 131 | Skeleton commands take an optional numeric prefix argument |
| 88 | (@xref{Arguments}). This is interpreted in two different ways depending | 132 | (@xref{(emacs)Arguments}). This is interpreted in two different ways depending |
| 89 | on whether the prefix is positive, i.e. forwards oriented or negative, | 133 | on whether the prefix is positive, i.e. forwards oriented or negative, |
| 90 | i.e. backwards oriented. | 134 | i.e. backwards oriented. |
| 91 | 135 | ||
| 92 | A positive prefix means to wrap the skeleton around that many following | 136 | A positive prefix means to wrap the skeleton around that many |
| 93 | words. This is accomplished by putting the words there where the point is | 137 | following words. This is accomplished by putting the words there where |
| 94 | normally left after that skeleton is inserted (@xref{Using Skeletons}). The | 138 | the point is normally left after that skeleton is inserted (@xref{Using |
| 95 | point (@xref{Point}) is left at the next interesting spot in the skeleton | 139 | Skeletons}). The point (@xref{(emacs)Point}) is left at the next |
| 96 | instead. | 140 | interesting spot in the skeleton instead. |
| 97 | 141 | ||
| 98 | A negative prefix means to do something similar with that many precedingly | 142 | A negative prefix means to do something similar with that many precedingly |
| 99 | marked interregions (@xref{Mark}). In the simplest case, if you type | 143 | marked interregions (@xref{(emacs)Mark}). In the simplest case, if you type |
| 100 | @kbd{M--} just before issuing the skeleton command, that will wrap the | 144 | @kbd{M--} just before issuing the skeleton command, that will wrap the |
| 101 | skeleton around the current region, just like a positive argument would have | 145 | skeleton around the current region, just like a positive argument would have |
| 102 | wrapped it around a number of words. | 146 | wrapped it around a number of words. |
| @@ -124,12 +168,12 @@ tried to follow the order in which you marked these points. | |||
| 124 | 168 | ||
| 125 | 169 | ||
| 126 | @node Skeletons as Abbrevs | 170 | @node Skeletons as Abbrevs |
| 127 | @section Skeletons as Abbrev Expansions | 171 | @chapter Skeletons as Abbrev Expansions |
| 128 | @cindex skeletons as abbrevs | 172 | @cindex skeletons as abbrevs |
| 129 | 173 | ||
| 130 | Rather than use a keybinding for every skeleton command, you can also define | 174 | Rather than use a keybinding for every skeleton command, you can also |
| 131 | an abbreviation (@xref{Defining Abbrevs}) that will expand (@xref{Expanding | 175 | define an abbreviation (@xref{(emacs)Defining Abbrevs}) that will expand |
| 132 | Abbrevs}) into the skeleton. | 176 | (@xref{(emacs)Expanding Abbrevs}) into the skeleton. |
| 133 | 177 | ||
| 134 | Say you want @samp{ifst} to be an abbreviation for the C language if | 178 | Say you want @samp{ifst} to be an abbreviation for the C language if |
| 135 | statement. You will tell Emacs that @samp{ifst} expands to the empty string | 179 | statement. You will tell Emacs that @samp{ifst} expands to the empty string |
| @@ -149,7 +193,7 @@ have been omitted.) | |||
| 149 | 193 | ||
| 150 | 194 | ||
| 151 | @node Skeleton Language | 195 | @node Skeleton Language |
| 152 | @section Skeleton Language | 196 | @chapter Skeleton Language |
| 153 | @cindex skeleton language | 197 | @cindex skeleton language |
| 154 | 198 | ||
| 155 | @findex skeleton-insert | 199 | @findex skeleton-insert |
| @@ -228,12 +272,12 @@ skeleton. The first argument is the command name, the second is a | |||
| 228 | documentation string, and the rest is an interactor and any number of skeleton | 272 | documentation string, and the rest is an interactor and any number of skeleton |
| 229 | elements together forming a skeleton. This skeleton is assigned to a variable | 273 | elements together forming a skeleton. This skeleton is assigned to a variable |
| 230 | of the same name as the command and can thus be overridden from your | 274 | of the same name as the command and can thus be overridden from your |
| 231 | @file{~/.emacs} file (@xref{Init File}). | 275 | @file{~/.emacs} file (@xref{(emacs)Init File}). |
| 232 | 276 | ||
| 233 | 277 | ||
| 234 | 278 | ||
| 235 | @node Inserting Pairs | 279 | @node Inserting Pairs |
| 236 | @section Inserting Matching Pairs of Characters | 280 | @chapter Inserting Matching Pairs of Characters |
| 237 | @cindex inserting pairs | 281 | @cindex inserting pairs |
| 238 | @cindex pairs | 282 | @cindex pairs |
| 239 | 283 | ||
| @@ -247,12 +291,13 @@ fingers backwards, this can be quite relieving too. | |||
| 247 | 291 | ||
| 248 | @findex pair-insert-maybe | 292 | @findex pair-insert-maybe |
| 249 | @vindex pair | 293 | @vindex pair |
| 250 | This is done by binding the first key (@xref{Rebinding}) of the pair to | 294 | This is done by binding the first key (@xref{(emacs)Rebinding}) of the |
| 251 | @code{pair-insert-maybe} instead of @code{self-insert-command}. The maybe | 295 | pair to @code{pair-insert-maybe} instead of @code{self-insert-command}. |
| 252 | comes from the fact that this at first surprising behaviour is initially | 296 | The maybe comes from the fact that this at first surprising behaviour is |
| 253 | turned off. To enable it, you must set @code{pair} to some non-@code{nil} | 297 | initially turned off. To enable it, you must set @code{pair} to some |
| 254 | value. And even then, a positive argument (@xref{Arguments}) will make this | 298 | non-@code{nil} value. And even then, a positive argument |
| 255 | key behave like a self inserting key (@xref{Inserting Text}). | 299 | (@xref{(emacs)Arguments}) will make this key behave like a self |
| 300 | inserting key (@xref{(emacs)Inserting Text}). | ||
| 256 | 301 | ||
| 257 | @findex pair-on-word | 302 | @findex pair-on-word |
| 258 | While this breaks with the stated intention of always balancing pairs, it | 303 | While this breaks with the stated intention of always balancing pairs, it |
| @@ -279,7 +324,7 @@ in certain contexts. For example an escaped character will stand for itself. | |||
| 279 | 324 | ||
| 280 | 325 | ||
| 281 | @node Autoinserting | 326 | @node Autoinserting |
| 282 | @section Autoinserting Text in Empty Files | 327 | @chapter Autoinserting Text in Empty Files |
| 283 | @cindex autoinserting | 328 | @cindex autoinserting |
| 284 | 329 | ||
| 285 | @findex auto-insert | 330 | @findex auto-insert |
| @@ -287,8 +332,8 @@ in certain contexts. For example an escaped character will stand for itself. | |||
| 287 | the buffer. The main application for this function, as its name suggests, | 332 | the buffer. The main application for this function, as its name suggests, |
| 288 | is to have it be called automatically every time an empty, and only an | 333 | is to have it be called automatically every time an empty, and only an |
| 289 | empty file is visited. This is accomplished by putting @code{(add-hook | 334 | empty file is visited. This is accomplished by putting @code{(add-hook |
| 290 | 'find-file-hooks 'auto-insert)} into your @file{~/.emacs} file (@xref{Init | 335 | 'find-file-hooks 'auto-insert)} into your @file{~/.emacs} file |
| 291 | File}). | 336 | (@xref{(emacs)Init File}). |
| 292 | 337 | ||
| 293 | @vindex auto-insert-alist | 338 | @vindex auto-insert-alist |
| 294 | What gets inserted, if anything, is determined by the variable | 339 | What gets inserted, if anything, is determined by the variable |
| @@ -324,11 +369,11 @@ files insert a skeleton with the usual frame. | |||
| 324 | files insert the usual header, with a copyright of your environment variable | 369 | files insert the usual header, with a copyright of your environment variable |
| 325 | @code{$ORGANIZATION} or else the FSF, and prompt for valid keywords describing | 370 | @code{$ORGANIZATION} or else the FSF, and prompt for valid keywords describing |
| 326 | the contents. Files in a @code{bin/} directory for which Emacs could | 371 | the contents. Files in a @code{bin/} directory for which Emacs could |
| 327 | determine no specialised mode (@xref{Choosing Modes}) are set to Shell script | 372 | determine no specialised mode (@xref{(emacs)Choosing Modes}) are set to Shell script |
| 328 | mode. | 373 | mode. |
| 329 | 374 | ||
| 330 | @findex define-auto-insert | 375 | @findex define-auto-insert |
| 331 | In Lisp (@xref{Init File}) you can use the function @code{define-auto-insert} | 376 | In Lisp (@xref{(emacs)Init File}) you can use the function @code{define-auto-insert} |
| 332 | to add to or modify @code{auto-insert-alist}. See its documentation with | 377 | to add to or modify @code{auto-insert-alist}. See its documentation with |
| 333 | @kbd{C-h f auto-insert-alist}. | 378 | @kbd{C-h f auto-insert-alist}. |
| 334 | 379 | ||
| @@ -363,14 +408,14 @@ expression that matched the filename. | |||
| 363 | 408 | ||
| 364 | 409 | ||
| 365 | @node Copyrights | 410 | @node Copyrights |
| 366 | @section Inserting and Updating Copyrights | 411 | @chapter Inserting and Updating Copyrights |
| 367 | @cindex copyrights | 412 | @cindex copyrights |
| 368 | 413 | ||
| 369 | @findex copyright | 414 | @findex copyright |
| 370 | @kbd{M-x copyright} is a skeleton inserting command, that adds a copyright | 415 | @kbd{M-x copyright} is a skeleton inserting command, that adds a copyright |
| 371 | notice at the point. The ``by'' part is taken from your environment variable | 416 | notice at the point. The ``by'' part is taken from your environment variable |
| 372 | @code{$ORGANIZATION} or if that isn't set you are prompted for it. If the | 417 | @code{$ORGANIZATION} or if that isn't set you are prompted for it. If the |
| 373 | buffer has a comment syntax (@xref{Comments}), this is inserted as a comment. | 418 | buffer has a comment syntax (@xref{(emacs)Comments}), this is inserted as a comment. |
| 374 | 419 | ||
| 375 | @findex copyright-update | 420 | @findex copyright-update |
| 376 | @vindex copyright-limit | 421 | @vindex copyright-limit |
| @@ -382,13 +427,13 @@ existing ones, in the same format as the preceding year, i.e. 1994, '94 or 94. | |||
| 382 | If a dash-separated year list up to last year is found, that is extended to | 427 | If a dash-separated year list up to last year is found, that is extended to |
| 383 | current year, else the year is added separated by a comma. Or it replaces | 428 | current year, else the year is added separated by a comma. Or it replaces |
| 384 | them when this is called with a prefix argument. If a header referring to a | 429 | them when this is called with a prefix argument. If a header referring to a |
| 385 | wrong version of the GNU General Public License (@xref{Copying}) is found, | 430 | wrong version of the GNU General Public License (@xref{(emacs)Copying}) is found, |
| 386 | that is updated too. | 431 | that is updated too. |
| 387 | 432 | ||
| 388 | An interesting application for this function is to have it be called | 433 | An interesting application for this function is to have it be called |
| 389 | automatically every time a file is saved. This is accomplished by putting | 434 | automatically every time a file is saved. This is accomplished by putting |
| 390 | @code{(add-hook 'write-file-hooks 'copyright-update)} into your @file{~/.emacs} | 435 | @code{(add-hook 'write-file-hooks 'copyright-update)} into your @file{~/.emacs} |
| 391 | file (@xref{Init File}). | 436 | file (@xref{(emacs)Init File}). |
| 392 | 437 | ||
| 393 | @vindex copyright-query | 438 | @vindex copyright-query |
| 394 | The variable @code{copyright-query} controls whether to update the | 439 | The variable @code{copyright-query} controls whether to update the |
| @@ -401,7 +446,7 @@ you are always queried. | |||
| 401 | 446 | ||
| 402 | 447 | ||
| 403 | @node Executables | 448 | @node Executables |
| 404 | @section Making Interpreter Scripts Executable | 449 | @chapter Making Interpreter Scripts Executable |
| 405 | @cindex executables | 450 | @cindex executables |
| 406 | 451 | ||
| 407 | @vindex executable-prefix | 452 | @vindex executable-prefix |
| @@ -415,7 +460,7 @@ system @code{chmod} command. The magic number is prefixed by the value of | |||
| 415 | @code{executable-prefix}. | 460 | @code{executable-prefix}. |
| 416 | 461 | ||
| 417 | @vindex executable-magicless-file-regexp | 462 | @vindex executable-magicless-file-regexp |
| 418 | Any file whos name matches @code{executable-magicless-file-regexp} is not | 463 | Any file whose name matches @code{executable-magicless-file-regexp} is not |
| 419 | furnished with a magic number, nor is it made executable. This is mainly | 464 | furnished with a magic number, nor is it made executable. This is mainly |
| 420 | intended for resource files, which are only meant to be read in. | 465 | intended for resource files, which are only meant to be read in. |
| 421 | 466 | ||
| @@ -446,3 +491,145 @@ mode. Otherwise you are alway queried. | |||
| 446 | will turn it into a self displaying text file, when called as a Un*x command. | 491 | will turn it into a self displaying text file, when called as a Un*x command. |
| 447 | The ``interpreter'' used is @code{executable-self-display} with argument | 492 | The ``interpreter'' used is @code{executable-self-display} with argument |
| 448 | @code{+2}. | 493 | @code{+2}. |
| 494 | |||
| 495 | @node Timestamps | ||
| 496 | @chapter Maintaining Timestamps in Modified Files | ||
| 497 | @cindex timestamps | ||
| 498 | |||
| 499 | @findex time-stamp | ||
| 500 | @vindex write-file-hooks | ||
| 501 | The @code{time-stamp} command can be used to update automatically a | ||
| 502 | template in a file with a new time stamp every time you save the file. | ||
| 503 | Customize the hook @code{write-file-hooks} to add the function | ||
| 504 | @code{time-stamp} to arrange this. | ||
| 505 | |||
| 506 | @vindex time-stamp-active | ||
| 507 | @vindex time-stamp-format | ||
| 508 | @vindex time-stamp-start | ||
| 509 | The time stamp is updated only if the customizable variable | ||
| 510 | @code{time-stamp-active} is on, which it is by default; the command | ||
| 511 | @code{time-stamp-toggle-active} can be used to toggle it. The format of | ||
| 512 | the time stamp is set by the customizable variable | ||
| 513 | @code{time-stamp-format}. | ||
| 514 | |||
| 515 | @vindex time-stamp-line-limit | ||
| 516 | @vindex time-stamp-end | ||
| 517 | @vindex time-stamp-count | ||
| 518 | @vindex time-stamp-inserts-lines | ||
| 519 | The variables @code{time-stamp-line-limit}, @code{time-stamp-start}, | ||
| 520 | @code{time-stamp-end}, @code{time-stamp-count}, and | ||
| 521 | @code{time-stamp-inserts-lines} control finding the template. Do not | ||
| 522 | change these in your init file or you will be incompatible with other | ||
| 523 | people's files. If you must change them, do so only in the local | ||
| 524 | variables section of the file itself. | ||
| 525 | |||
| 526 | Normally the template must appear in the first 8 lines of a file and | ||
| 527 | look like one of the following: | ||
| 528 | |||
| 529 | @example | ||
| 530 | Time-stamp: <> | ||
| 531 | Time-stamp: " " | ||
| 532 | @end example | ||
| 533 | |||
| 534 | The time stamp is written between the brackets or quotes: | ||
| 535 | |||
| 536 | @example | ||
| 537 | Time-stamp: <1998-02-18 10:20:51 gildea> | ||
| 538 | @end example | ||
| 539 | |||
| 540 | @node QuickURL | ||
| 541 | @chapter QuickURL: Inserting URLs Based on Text at Point | ||
| 542 | |||
| 543 | @vindex quickurl-url-file | ||
| 544 | @findex quickurl | ||
| 545 | @cindex URLs | ||
| 546 | @kbd{M-x quickurl} can be used to insert a URL into a buffer based on | ||
| 547 | the text at point. The URLs are stored in an external file defined by | ||
| 548 | the variable @code{quickurl-url-file} as a list of either cons cells of | ||
| 549 | the form @code{(@var{key} . @var{URL})} or | ||
| 550 | lists of the form @code{(@var{key} @var{URL} @var{comment})}. These | ||
| 551 | specify that @kbd{M-x quickurl} should insert @var{URL} if the word | ||
| 552 | @var{key} is at point, for example: | ||
| 553 | |||
| 554 | @example | ||
| 555 | (("FSF" "http://www.fsf.org/" "The Free Software Foundation") | ||
| 556 | ("emacs" . "http://www.emacs.org/") | ||
| 557 | ("hagbard" "http://www.hagbard.demon.co.uk" "Hagbard's World")) | ||
| 558 | @end example | ||
| 559 | |||
| 560 | @findex quickurl-add-url | ||
| 561 | @findex quickurl-list | ||
| 562 | @kbd{M-x quickurl-add-url} can be used to add a new @var{key}/@var{URL} | ||
| 563 | pair. @kbd{M-x quickurl-list} provides interactive editing of the URL | ||
| 564 | list. | ||
| 565 | |||
| 566 | @node Tempo | ||
| 567 | @chapter Tempo: Flexible Template Insertion | ||
| 568 | |||
| 569 | @cindex templates | ||
| 570 | The Tempo package provides a simple way to define powerful templates, or | ||
| 571 | macros, if you wish. It is mainly intended for, but not limited to, | ||
| 572 | other programmers to be used for creating shortcuts for editing | ||
| 573 | certain kinds of documents. | ||
| 574 | |||
| 575 | @findex tempo-backward-mark | ||
| 576 | @findex tempo-forward-mark | ||
| 577 | A template is defined as a list of items to be inserted in the current | ||
| 578 | buffer at point. Some can be simple strings, while others can control | ||
| 579 | formatting or define special points of interest in the inserted text. | ||
| 580 | @kbd{M-x tempo-backward-mark} and @kbd{M-x tempo-forward-mark} can be | ||
| 581 | used to jump between such points. | ||
| 582 | |||
| 583 | More flexible templates can be created by including lisp symbols, which | ||
| 584 | will be evaluated as variables, or lists, which will will be evaluated | ||
| 585 | as lisp expressions. Automatic completion of specified tags to expanded | ||
| 586 | templates can be provided. | ||
| 587 | |||
| 588 | @findex tempo-define-template | ||
| 589 | See the documentation for @code{tempo-define-template} for the different | ||
| 590 | items that can be used to define a tempo template with a command for | ||
| 591 | inserting it. | ||
| 592 | |||
| 593 | See the commentary in @file{tempo.el} for more information on using the | ||
| 594 | Tempo package. | ||
| 595 | |||
| 596 | @node Hippie Expand | ||
| 597 | @chapter `Hippie' Expansion | ||
| 598 | |||
| 599 | @findex hippie-expand | ||
| 600 | @kindex M-/ | ||
| 601 | @vindex hippie-expand-try-functions-list | ||
| 602 | @kbd{M-x hippie-expand} is a single command providing a variety of | ||
| 603 | completions and expansions. Called repeatedly, it tries all possible | ||
| 604 | completions in succession. | ||
| 605 | |||
| 606 | Which ones to try, and in which order, is determined by the contents of | ||
| 607 | the customizable option @code{hippie-expand-try-functions-list}. Much | ||
| 608 | customization of the expansion behaviour can be made by changing the | ||
| 609 | order of, removing, or inserting new functions in this list. Given a | ||
| 610 | positive numeric argument, @kbd{M-x hippie-expand} jumps directly that | ||
| 611 | number of functions forward in this list. Given some other argument (a | ||
| 612 | negative argument or just @kbd{C-u}) it undoes the tried completion. | ||
| 613 | |||
| 614 | See the commentary in @file{hippie-exp.el} for more information on the | ||
| 615 | possibilities. | ||
| 616 | |||
| 617 | Typically you would bind @code{hippie-expand} to @kbd{M-/} with | ||
| 618 | @code{dabbrev-expand}, the standard binding of @kbd{M-/}, providing one | ||
| 619 | of the expansion possibilities. | ||
| 620 | |||
| 621 | |||
| 622 | @node Concept Index | ||
| 623 | @unnumbered Concept Index | ||
| 624 | @printindex cp | ||
| 625 | |||
| 626 | @node Command Index | ||
| 627 | @unnumbered Command Index | ||
| 628 | @printindex fn | ||
| 629 | |||
| 630 | @node Variable Index | ||
| 631 | @unnumbered Variable Index | ||
| 632 | @printindex vr | ||
| 633 | |||
| 634 | @contents | ||
| 635 | @bye | ||