diff options
| author | Richard M. Stallman | 2006-02-08 00:07:17 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2006-02-08 00:07:17 +0000 |
| commit | 3f7ba267740e16c406e1509a86ec58867fe34e33 (patch) | |
| tree | fa36d8322d701a7354452b15d852a21e2043e36f | |
| parent | b6a71fbbe7b22df6856f8e517e61d661c7780bdf (diff) | |
| download | emacs-3f7ba267740e16c406e1509a86ec58867fe34e33.tar.gz emacs-3f7ba267740e16c406e1509a86ec58867fe34e33.zip | |
Minor clarifications.
(Dabbrev Customization): Talk about "dynamic abbrev expansion",
not "dynamic abbrevs" as if they were a kind of abbrev.
| -rw-r--r-- | man/abbrevs.texi | 124 |
1 files changed, 61 insertions, 63 deletions
diff --git a/man/abbrevs.texi b/man/abbrevs.texi index 9c66df9ff03..683da2204c1 100644 --- a/man/abbrevs.texi +++ b/man/abbrevs.texi | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | A defined @dfn{abbrev} is a word which @dfn{expands}, if you insert | 10 | A defined @dfn{abbrev} is a word which @dfn{expands}, if you insert |
| 11 | it, into some different text. Abbrevs are defined by the user to expand | 11 | it, into some different text. Abbrevs are defined by the user to expand |
| 12 | in specific ways. For example, you might define @samp{foo} as an abbrev | 12 | in specific ways. For example, you might define @samp{foo} as an abbrev |
| 13 | expanding to @samp{find outer otter}. Then you would be able to insert | 13 | expanding to @samp{find outer otter}. Then you could insert |
| 14 | @samp{find outer otter } into the buffer by typing @kbd{f o o | 14 | @samp{find outer otter } into the buffer by typing @kbd{f o o |
| 15 | @key{SPC}}. | 15 | @key{SPC}}. |
| 16 | 16 | ||
| @@ -20,9 +20,9 @@ to expand the letters in the buffer before point by looking for other | |||
| 20 | words in the buffer that start with those letters. @xref{Dynamic | 20 | words in the buffer that start with those letters. @xref{Dynamic |
| 21 | Abbrevs}. | 21 | Abbrevs}. |
| 22 | 22 | ||
| 23 | ``Hippie'' expansion generalizes abbreviation expansion. @xref{Hippie | 23 | ``Hippie'' expansion generalizes abbreviation expansion. |
| 24 | Expand, , Hippie Expansion, autotype, Features for Automatic | 24 | @xref{Hippie Expand, , Hippie Expansion, autotype, Features for |
| 25 | Typing}. | 25 | Automatic Typing}. |
| 26 | 26 | ||
| 27 | @menu | 27 | @menu |
| 28 | * Abbrev Concepts:: Fundamentals of defined abbrevs. | 28 | * Abbrev Concepts:: Fundamentals of defined abbrevs. |
| @@ -57,16 +57,16 @@ turns Abbrev mode on if the argument is positive, off otherwise. | |||
| 57 | on when the variable is non-@code{nil}. The variable @code{abbrev-mode} | 57 | on when the variable is non-@code{nil}. The variable @code{abbrev-mode} |
| 58 | automatically becomes local to the current buffer when it is set. | 58 | automatically becomes local to the current buffer when it is set. |
| 59 | 59 | ||
| 60 | Abbrev definitions can be @dfn{mode-specific}---active only in one major | 60 | Abbrevs can have @dfn{mode-specific} definitions, active only in one major |
| 61 | mode. Abbrevs can also have @dfn{global} definitions that are active in | 61 | mode. Abbrevs can also have @dfn{global} definitions that are active in |
| 62 | all major modes. The same abbrev can have a global definition and various | 62 | all major modes. The same abbrev can have a global definition and various |
| 63 | mode-specific definitions for different major modes. A mode-specific | 63 | mode-specific definitions for different major modes. A mode-specific |
| 64 | definition for the current major mode overrides a global definition. | 64 | definition for the current major mode overrides a global definition. |
| 65 | 65 | ||
| 66 | Abbrevs can be defined interactively during the editing session. Lists | 66 | Yu can define abbrevs interactively during the editing session. You |
| 67 | of abbrev definitions can also be saved in files and reloaded in later | 67 | can also save lists of abbrev definitions in files for use in later |
| 68 | sessions. Some users keep extensive lists of abbrevs that they load in | 68 | sessions. Some users keep extensive lists of abbrevs that they load |
| 69 | every session. | 69 | in every session. |
| 70 | 70 | ||
| 71 | @node Defining Abbrevs | 71 | @node Defining Abbrevs |
| 72 | @section Defining Abbrevs | 72 | @section Defining Abbrevs |
| @@ -88,8 +88,7 @@ Define @var{abbrev} as an abbrev expanding into @var{exp}. | |||
| 88 | @item M-x define-mode-abbrev @key{RET} @var{abbrev} @key{RET} @var{exp} @key{RET} | 88 | @item M-x define-mode-abbrev @key{RET} @var{abbrev} @key{RET} @var{exp} @key{RET} |
| 89 | Define @var{abbrev} as a mode-specific abbrev expanding into @var{exp}. | 89 | Define @var{abbrev} as a mode-specific abbrev expanding into @var{exp}. |
| 90 | @item M-x kill-all-abbrevs | 90 | @item M-x kill-all-abbrevs |
| 91 | This command discards all abbrev definitions currently in effect, | 91 | Discard all abbrev definitions, leaving a blank slate. |
| 92 | leaving a blank slate. | ||
| 93 | @end table | 92 | @end table |
| 94 | 93 | ||
| 95 | @kindex C-x a g | 94 | @kindex C-x a g |
| @@ -118,13 +117,13 @@ as for @kbd{C-x a g}. | |||
| 118 | @findex inverse-add-global-abbrev | 117 | @findex inverse-add-global-abbrev |
| 119 | @kindex C-x a i l | 118 | @kindex C-x a i l |
| 120 | @findex inverse-add-mode-abbrev | 119 | @findex inverse-add-mode-abbrev |
| 121 | If the text already in the buffer is the abbrev, rather than its | 120 | If the abbrev text itself is already in the buffer, you can use the |
| 122 | expansion, use command @kbd{C-x a i g} | 121 | commands @kbd{C-x a i g} (@code{inverse-add-global-abbrev}) and |
| 123 | (@code{inverse-add-global-abbrev}) instead of @kbd{C-x a g}, or use | 122 | @kbd{C-x a i l} (@code{inverse-add-mode-abbrev}) to define it as an |
| 124 | @kbd{C-x a i l} (@code{inverse-add-mode-abbrev}) instead of @kbd{C-x a | 123 | abbrev by specify the expansion in the minibuffer. These commands are |
| 125 | l}. These commands are called ``inverse'' because they invert the | 124 | called ``inverse'' because they invert the meaning of the two text |
| 126 | meaning of the two text strings they use (one from the buffer and one | 125 | strings they use (one from the buffer and one read with the |
| 127 | read with the minibuffer). | 126 | minibuffer). |
| 128 | 127 | ||
| 129 | @findex define-mode-abbrev | 128 | @findex define-mode-abbrev |
| 130 | @findex define-global-abbrev | 129 | @findex define-global-abbrev |
| @@ -137,14 +136,12 @@ It reads two arguments---the abbrev, and its expansion. The command | |||
| 137 | When the abbrev has a prior definition, the abbrev definition commands | 136 | When the abbrev has a prior definition, the abbrev definition commands |
| 138 | ask for confirmation before replacing it. | 137 | ask for confirmation before replacing it. |
| 139 | 138 | ||
| 140 | To remove an abbrev definition, give a negative argument to the abbrev | ||
| 141 | definition command: @kbd{C-u - C-x a g} or @kbd{C-u - C-x a l}. The | ||
| 142 | former removes a global definition, while the latter removes a | ||
| 143 | mode-specific definition. | ||
| 144 | |||
| 145 | @findex kill-all-abbrevs | 139 | @findex kill-all-abbrevs |
| 146 | @kbd{M-x kill-all-abbrevs} removes all the abbrev definitions there | 140 | To remove an abbrev definition, give a negative argument to the |
| 147 | are, both global and local. | 141 | abbrev definition command: @kbd{C-u - C-x a g} or @kbd{C-u - C-x a l}. |
| 142 | The former removes a global definition, while the latter removes a | ||
| 143 | mode-specific definition. @kbd{M-x kill-all-abbrevs} removes all | ||
| 144 | abbrev definitions, both global and local. | ||
| 148 | 145 | ||
| 149 | @node Expanding Abbrevs | 146 | @node Expanding Abbrevs |
| 150 | @section Controlling Abbrev Expansion | 147 | @section Controlling Abbrev Expansion |
| @@ -179,9 +176,9 @@ Expand some or all abbrevs found in the region. | |||
| 179 | 176 | ||
| 180 | @kindex M-' | 177 | @kindex M-' |
| 181 | @findex abbrev-prefix-mark | 178 | @findex abbrev-prefix-mark |
| 182 | You may wish to expand an abbrev with a prefix attached; for example, | 179 | You may wish to expand an abbrev and attach a prefix to the expansion; |
| 183 | if @samp{cnst} expands into @samp{construction}, you might want to use | 180 | for example, if @samp{cnst} expands into @samp{construction}, you might want |
| 184 | it to enter @samp{reconstruction}. It does not work to type | 181 | to use it to enter @samp{reconstruction}. It does not work to type |
| 185 | @kbd{recnst}, because that is not necessarily a defined abbrev. What | 182 | @kbd{recnst}, because that is not necessarily a defined abbrev. What |
| 186 | you can do is use the command @kbd{M-'} (@code{abbrev-prefix-mark}) in | 183 | you can do is use the command @kbd{M-'} (@code{abbrev-prefix-mark}) in |
| 187 | between the prefix @samp{re} and the abbrev @samp{cnst}. First, insert | 184 | between the prefix @samp{re} and the abbrev @samp{cnst}. First, insert |
| @@ -195,7 +192,7 @@ used. The result is the desired @samp{reconstruction}. | |||
| 195 | If you actually want the text of the abbrev in the buffer, rather than | 192 | If you actually want the text of the abbrev in the buffer, rather than |
| 196 | its expansion, you can accomplish this by inserting the following | 193 | its expansion, you can accomplish this by inserting the following |
| 197 | punctuation with @kbd{C-q}. Thus, @kbd{foo C-q ,} leaves @samp{foo,} in | 194 | punctuation with @kbd{C-q}. Thus, @kbd{foo C-q ,} leaves @samp{foo,} in |
| 198 | the buffer. | 195 | the buffer, not expanding it. |
| 199 | 196 | ||
| 200 | @findex unexpand-abbrev | 197 | @findex unexpand-abbrev |
| 201 | If you expand an abbrev by mistake, you can undo the expansion and | 198 | If you expand an abbrev by mistake, you can undo the expansion and |
| @@ -234,6 +231,7 @@ Edit a list of abbrevs; you can add, alter or remove definitions. | |||
| 234 | The output from @kbd{M-x list-abbrevs} looks like this: | 231 | The output from @kbd{M-x list-abbrevs} looks like this: |
| 235 | 232 | ||
| 236 | @example | 233 | @example |
| 234 | @var{various other tables@dots{}} | ||
| 237 | (lisp-mode-abbrev-table) | 235 | (lisp-mode-abbrev-table) |
| 238 | "dk" 0 "define-key" | 236 | "dk" 0 "define-key" |
| 239 | (global-abbrev-table) | 237 | (global-abbrev-table) |
| @@ -322,16 +320,16 @@ variable @code{save-abbrevs} to @code{nil}. | |||
| 322 | similar to the previous commands but work on text in an Emacs buffer. | 320 | similar to the previous commands but work on text in an Emacs buffer. |
| 323 | @kbd{M-x insert-abbrevs} inserts text into the current buffer after point, | 321 | @kbd{M-x insert-abbrevs} inserts text into the current buffer after point, |
| 324 | describing all current abbrev definitions; @kbd{M-x define-abbrevs} parses | 322 | describing all current abbrev definitions; @kbd{M-x define-abbrevs} parses |
| 325 | the entire current buffer and defines abbrevs accordingly.@refill | 323 | the entire current buffer and defines abbrevs accordingly. |
| 326 | 324 | ||
| 327 | @node Dynamic Abbrevs | 325 | @node Dynamic Abbrevs |
| 328 | @section Dynamic Abbrev Expansion | 326 | @section Dynamic Abbrev Expansion |
| 329 | 327 | ||
| 330 | The abbrev facility described above operates automatically as you insert | 328 | The abbrev facility described above operates automatically as you |
| 331 | text, but all abbrevs must be defined explicitly. By contrast, | 329 | insert text, but all abbrevs must be defined explicitly. By contrast, |
| 332 | @dfn{dynamic abbrevs} allow the meanings of abbrevs to be determined | 330 | @dfn{dynamic abbrevs} allow the meanings of abbreviations to be |
| 333 | automatically from the contents of the buffer, but dynamic abbrev expansion | 331 | determined automatically from the contents of the buffer, but dynamic |
| 334 | happens only when you request it explicitly. | 332 | abbrev expansion happens only when you request it explicitly. |
| 335 | 333 | ||
| 336 | @kindex M-/ | 334 | @kindex M-/ |
| 337 | @kindex C-M-/ | 335 | @kindex C-M-/ |
| @@ -357,7 +355,7 @@ expansion found looking backward from point. Repeating @kbd{M-/} | |||
| 357 | searches for an alternative expansion by looking farther back. After | 355 | searches for an alternative expansion by looking farther back. After |
| 358 | scanning all the text before point, it searches the text after point. | 356 | scanning all the text before point, it searches the text after point. |
| 359 | The variable @code{dabbrev-limit}, if non-@code{nil}, specifies how far | 357 | The variable @code{dabbrev-limit}, if non-@code{nil}, specifies how far |
| 360 | in the buffer to search for an expansion. | 358 | away in the buffer to search for an expansion. |
| 361 | 359 | ||
| 362 | @vindex dabbrev-check-all-buffers | 360 | @vindex dabbrev-check-all-buffers |
| 363 | After scanning the current buffer, @kbd{M-/} normally searches other | 361 | After scanning the current buffer, @kbd{M-/} normally searches other |
| @@ -372,21 +370,20 @@ expressions, dynamic abbrev expansion skips that buffer. | |||
| 372 | 370 | ||
| 373 | A negative argument to @kbd{M-/}, as in @kbd{C-u - M-/}, says to | 371 | A negative argument to @kbd{M-/}, as in @kbd{C-u - M-/}, says to |
| 374 | search first for expansions after point, then other buffers, and | 372 | search first for expansions after point, then other buffers, and |
| 375 | consider expansions before point only as a last resort. | 373 | consider expansions before point only as a last resort. If you repeat |
| 376 | 374 | the @kbd{M-/} to look for another expansion, do not specify an | |
| 377 | If you repeat the @kbd{M-/} to look for another expansion, do not | 375 | argument. Repeating @kbd{M-/} cycles through all the expansions after |
| 378 | specify an argument. This tries all the expansions after point and | 376 | point and then the expansions before point. |
| 379 | then the expansions before point. | ||
| 380 | 377 | ||
| 381 | After you have expanded a dynamic abbrev, you can copy additional | 378 | After you have expanded a dynamic abbrev, you can copy additional |
| 382 | words that follow the expansion in its original context. Simply type | 379 | words that follow the expansion in its original context. Simply type |
| 383 | @kbd{@key{SPC} M-/} for each word you want to copy. The spacing and | 380 | @kbd{@key{SPC} M-/} for each additional word you want to copy. The |
| 384 | punctuation between words is copied along with the words. | 381 | spacing and punctuation between words is copied along with the words. |
| 385 | 382 | ||
| 386 | The command @kbd{C-M-/} (@code{dabbrev-completion}) performs | 383 | The command @kbd{C-M-/} (@code{dabbrev-completion}) performs |
| 387 | completion of a dynamic abbreviation. Instead of trying the possible | 384 | completion of a dynamic abbrev. Instead of trying the possible |
| 388 | expansions one by one, it finds all of them, then inserts the text that | 385 | expansions one by one, it finds all of them, then inserts the text |
| 389 | they have in common. If they have nothing in common, @kbd{C-M-/} | 386 | that they have in common. If they have nothing in common, @kbd{C-M-/} |
| 390 | displays a list of completions, from which you can select a choice in | 387 | displays a list of completions, from which you can select a choice in |
| 391 | the usual manner. @xref{Completion}. | 388 | the usual manner. @xref{Completion}. |
| 392 | 389 | ||
| @@ -411,24 +408,25 @@ in case. If the value of @code{dabbrev-case-fold-search} is | |||
| 411 | for expansions. | 408 | for expansions. |
| 412 | 409 | ||
| 413 | @vindex dabbrev-case-replace | 410 | @vindex dabbrev-case-replace |
| 414 | Normally, dynamic abbrev expansion preserves the case pattern @emph{of | 411 | Normally, dynamic abbrev expansion preserves the case pattern |
| 415 | the abbrev you have typed}, by converting the expansion to that case | 412 | @emph{of the dynamic abbrev you are expanding}, by converting the |
| 416 | pattern. | 413 | expansion to that case pattern. |
| 417 | 414 | ||
| 418 | @vindex dabbrev-case-fold-search | 415 | @vindex dabbrev-case-fold-search |
| 419 | The variable @code{dabbrev-case-replace} controls whether to preserve | 416 | The variable @code{dabbrev-case-replace} controls whether to |
| 420 | the case pattern of the abbrev. If it is @code{t}, the abbrev's case | 417 | preserve the case pattern of the dynamic abbrev. If it is @code{t}, |
| 421 | pattern is preserved in most cases; if it is @code{nil}, the expansion is | 418 | the dynamic abbrev's case pattern is preserved in most cases; if it is |
| 422 | always copied verbatim. If the value of @code{dabbrev-case-replace} is | 419 | @code{nil}, the expansion is always copied verbatim. If the value of |
| 423 | @code{case-replace}, which is true by default, then the variable | 420 | @code{dabbrev-case-replace} is @code{case-replace}, which is true by |
| 424 | @code{case-replace} controls whether to copy the expansion verbatim. | 421 | default, then the variable @code{case-replace} controls whether to |
| 422 | copy the expansion verbatim. | ||
| 425 | 423 | ||
| 426 | However, if the expansion contains a complex mixed case pattern, and | 424 | However, if the expansion contains a complex mixed case pattern, and |
| 427 | the abbrev matches this pattern as far as it goes, then the expansion is | 425 | the dynamic abbrev matches this pattern as far as it goes, then the |
| 428 | always copied verbatim, regardless of those variables. Thus, for | 426 | expansion is always copied verbatim, regardless of those variables. |
| 429 | example, if the buffer contains @code{variableWithSillyCasePattern}, and | 427 | Thus, for example, if the buffer contains |
| 430 | you type @kbd{v a M-/}, it copies the expansion verbatim including its | 428 | @code{variableWithSillyCasePattern}, and you type @kbd{v a M-/}, it |
| 431 | case pattern. | 429 | copies the expansion verbatim including its case pattern. |
| 432 | 430 | ||
| 433 | @vindex dabbrev-abbrev-char-regexp | 431 | @vindex dabbrev-abbrev-char-regexp |
| 434 | The variable @code{dabbrev-abbrev-char-regexp}, if non-@code{nil}, | 432 | The variable @code{dabbrev-abbrev-char-regexp}, if non-@code{nil}, |
| @@ -436,16 +434,16 @@ controls which characters are considered part of a word, for dynamic expansion | |||
| 436 | purposes. The regular expression must match just one character, never | 434 | purposes. The regular expression must match just one character, never |
| 437 | two or more. The same regular expression also determines which | 435 | two or more. The same regular expression also determines which |
| 438 | characters are part of an expansion. The value @code{nil} has a special | 436 | characters are part of an expansion. The value @code{nil} has a special |
| 439 | meaning: abbreviations are made of word characters, but expansions are | 437 | meaning: dynamic abbrevs are made of word characters, but expansions are |
| 440 | made of word and symbol characters. | 438 | made of word and symbol characters. |
| 441 | 439 | ||
| 442 | @vindex dabbrev-abbrev-skip-leading-regexp | 440 | @vindex dabbrev-abbrev-skip-leading-regexp |
| 443 | In shell scripts and makefiles, a variable name is sometimes prefixed | 441 | In shell scripts and makefiles, a variable name is sometimes prefixed |
| 444 | with @samp{$} and sometimes not. Major modes for this kind of text can | 442 | with @samp{$} and sometimes not. Major modes for this kind of text can |
| 445 | customize dynamic abbreviation to handle optional prefixes by setting | 443 | customize dynamic abbrev expansion to handle optional prefixes by setting |
| 446 | the variable @code{dabbrev-abbrev-skip-leading-regexp}. Its value | 444 | the variable @code{dabbrev-abbrev-skip-leading-regexp}. Its value |
| 447 | should be a regular expression that matches the optional prefix that | 445 | should be a regular expression that matches the optional prefix that |
| 448 | dynamic abbreviation should ignore. | 446 | dynamic abbrev expression should ignore. |
| 449 | 447 | ||
| 450 | @ignore | 448 | @ignore |
| 451 | arch-tag: 638e0079-9540-48ec-9166-414083e16445 | 449 | arch-tag: 638e0079-9540-48ec-9166-414083e16445 |