aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2006-02-08 00:07:17 +0000
committerRichard M. Stallman2006-02-08 00:07:17 +0000
commit3f7ba267740e16c406e1509a86ec58867fe34e33 (patch)
treefa36d8322d701a7354452b15d852a21e2043e36f
parentb6a71fbbe7b22df6856f8e517e61d661c7780bdf (diff)
downloademacs-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.texi124
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
11it, into some different text. Abbrevs are defined by the user to expand 11it, into some different text. Abbrevs are defined by the user to expand
12in specific ways. For example, you might define @samp{foo} as an abbrev 12in specific ways. For example, you might define @samp{foo} as an abbrev
13expanding to @samp{find outer otter}. Then you would be able to insert 13expanding 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
20words in the buffer that start with those letters. @xref{Dynamic 20words in the buffer that start with those letters. @xref{Dynamic
21Abbrevs}. 21Abbrevs}.
22 22
23``Hippie'' expansion generalizes abbreviation expansion. @xref{Hippie 23 ``Hippie'' expansion generalizes abbreviation expansion.
24Expand, , Hippie Expansion, autotype, Features for Automatic 24@xref{Hippie Expand, , Hippie Expansion, autotype, Features for
25Typing}. 25Automatic 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.
57on when the variable is non-@code{nil}. The variable @code{abbrev-mode} 57on when the variable is non-@code{nil}. The variable @code{abbrev-mode}
58automatically becomes local to the current buffer when it is set. 58automatically 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
61mode. Abbrevs can also have @dfn{global} definitions that are active in 61mode. Abbrevs can also have @dfn{global} definitions that are active in
62all major modes. The same abbrev can have a global definition and various 62all major modes. The same abbrev can have a global definition and various
63mode-specific definitions for different major modes. A mode-specific 63mode-specific definitions for different major modes. A mode-specific
64definition for the current major mode overrides a global definition. 64definition 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
67of abbrev definitions can also be saved in files and reloaded in later 67can also save lists of abbrev definitions in files for use in later
68sessions. Some users keep extensive lists of abbrevs that they load in 68sessions. Some users keep extensive lists of abbrevs that they load
69every session. 69in 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}
89Define @var{abbrev} as a mode-specific abbrev expanding into @var{exp}. 89Define @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
91This command discards all abbrev definitions currently in effect, 91Discard all abbrev definitions, leaving a blank slate.
92leaving 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
122expansion, use command @kbd{C-x a i g} 121commands @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 123abbrev by specify the expansion in the minibuffer. These commands are
125l}. These commands are called ``inverse'' because they invert the 124called ``inverse'' because they invert the meaning of the two text
126meaning of the two text strings they use (one from the buffer and one 125strings they use (one from the buffer and one read with the
127read with the minibuffer). 126minibuffer).
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
137When the abbrev has a prior definition, the abbrev definition commands 136When the abbrev has a prior definition, the abbrev definition commands
138ask for confirmation before replacing it. 137ask for confirmation before replacing it.
139 138
140 To remove an abbrev definition, give a negative argument to the abbrev
141definition command: @kbd{C-u - C-x a g} or @kbd{C-u - C-x a l}. The
142former removes a global definition, while the latter removes a
143mode-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
147are, both global and local. 141abbrev definition command: @kbd{C-u - C-x a g} or @kbd{C-u - C-x a l}.
142The former removes a global definition, while the latter removes a
143mode-specific definition. @kbd{M-x kill-all-abbrevs} removes all
144abbrev 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;
183if @samp{cnst} expands into @samp{construction}, you might want to use 180for example, if @samp{cnst} expands into @samp{construction}, you might want
184it to enter @samp{reconstruction}. It does not work to type 181to 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
186you can do is use the command @kbd{M-'} (@code{abbrev-prefix-mark}) in 183you can do is use the command @kbd{M-'} (@code{abbrev-prefix-mark}) in
187between the prefix @samp{re} and the abbrev @samp{cnst}. First, insert 184between 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
196its expansion, you can accomplish this by inserting the following 193its expansion, you can accomplish this by inserting the following
197punctuation with @kbd{C-q}. Thus, @kbd{foo C-q ,} leaves @samp{foo,} in 194punctuation with @kbd{C-q}. Thus, @kbd{foo C-q ,} leaves @samp{foo,} in
198the buffer. 195the 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}.
322similar to the previous commands but work on text in an Emacs buffer. 320similar 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,
324describing all current abbrev definitions; @kbd{M-x define-abbrevs} parses 322describing all current abbrev definitions; @kbd{M-x define-abbrevs} parses
325the entire current buffer and defines abbrevs accordingly.@refill 323the 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
331text, but all abbrevs must be defined explicitly. By contrast, 329insert 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
333automatically from the contents of the buffer, but dynamic abbrev expansion 331determined automatically from the contents of the buffer, but dynamic
334happens only when you request it explicitly. 332abbrev 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-/}
357searches for an alternative expansion by looking farther back. After 355searches for an alternative expansion by looking farther back. After
358scanning all the text before point, it searches the text after point. 356scanning all the text before point, it searches the text after point.
359The variable @code{dabbrev-limit}, if non-@code{nil}, specifies how far 357The variable @code{dabbrev-limit}, if non-@code{nil}, specifies how far
360in the buffer to search for an expansion. 358away 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
374search first for expansions after point, then other buffers, and 372search first for expansions after point, then other buffers, and
375consider expansions before point only as a last resort. 373consider expansions before point only as a last resort. If you repeat
376 374the @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 375argument. Repeating @kbd{M-/} cycles through all the expansions after
378specify an argument. This tries all the expansions after point and 376point and then the expansions before point.
379then 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
382words that follow the expansion in its original context. Simply type 379words 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
384punctuation between words is copied along with the words. 381spacing 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
387completion of a dynamic abbreviation. Instead of trying the possible 384completion of a dynamic abbrev. Instead of trying the possible
388expansions one by one, it finds all of them, then inserts the text that 385expansions one by one, it finds all of them, then inserts the text
389they have in common. If they have nothing in common, @kbd{C-M-/} 386that they have in common. If they have nothing in common, @kbd{C-M-/}
390displays a list of completions, from which you can select a choice in 387displays a list of completions, from which you can select a choice in
391the usual manner. @xref{Completion}. 388the usual manner. @xref{Completion}.
392 389
@@ -411,24 +408,25 @@ in case. If the value of @code{dabbrev-case-fold-search} is
411for expansions. 408for 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
415the abbrev you have typed}, by converting the expansion to that case 412@emph{of the dynamic abbrev you are expanding}, by converting the
416pattern. 413expansion 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
420the case pattern of the abbrev. If it is @code{t}, the abbrev's case 417preserve the case pattern of the dynamic abbrev. If it is @code{t},
421pattern is preserved in most cases; if it is @code{nil}, the expansion is 418the dynamic abbrev's case pattern is preserved in most cases; if it is
422always 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. 421default, then the variable @code{case-replace} controls whether to
422copy 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
427the abbrev matches this pattern as far as it goes, then the expansion is 425the dynamic abbrev matches this pattern as far as it goes, then the
428always copied verbatim, regardless of those variables. Thus, for 426expansion is always copied verbatim, regardless of those variables.
429example, if the buffer contains @code{variableWithSillyCasePattern}, and 427Thus, for example, if the buffer contains
430you type @kbd{v a M-/}, it copies the expansion verbatim including its 428@code{variableWithSillyCasePattern}, and you type @kbd{v a M-/}, it
431case pattern. 429copies 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
436purposes. The regular expression must match just one character, never 434purposes. The regular expression must match just one character, never
437two or more. The same regular expression also determines which 435two or more. The same regular expression also determines which
438characters are part of an expansion. The value @code{nil} has a special 436characters are part of an expansion. The value @code{nil} has a special
439meaning: abbreviations are made of word characters, but expansions are 437meaning: dynamic abbrevs are made of word characters, but expansions are
440made of word and symbol characters. 438made 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
444with @samp{$} and sometimes not. Major modes for this kind of text can 442with @samp{$} and sometimes not. Major modes for this kind of text can
445customize dynamic abbreviation to handle optional prefixes by setting 443customize dynamic abbrev expansion to handle optional prefixes by setting
446the variable @code{dabbrev-abbrev-skip-leading-regexp}. Its value 444the variable @code{dabbrev-abbrev-skip-leading-regexp}. Its value
447should be a regular expression that matches the optional prefix that 445should be a regular expression that matches the optional prefix that
448dynamic abbreviation should ignore. 446dynamic 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