summaryrefslogtreecommitdiff
path: root/lispref/abbrevs.texi
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2004-07-17 14:39:11 +0000
committerRichard M. Stallman <rms@gnu.org>2004-07-17 14:39:11 +0000
commit9206efb955c708b66c688f29a5eb15507b9f2405 (patch)
tree587e45cc0854c6d72f803320388d997ad878255f /lispref/abbrevs.texi
parent442a68c7f15f7c3eafec34a66db6d3d25f7d3046 (diff)
downloademacs-9206efb955c708b66c688f29a5eb15507b9f2405.tar.gz
(Abbrev Expansion): Clarify pre-abbrev-expand-hook, fix example.
Diffstat (limited to 'lispref/abbrevs.texi')
-rw-r--r--lispref/abbrevs.texi13
1 files changed, 5 insertions, 8 deletions
diff --git a/lispref/abbrevs.texi b/lispref/abbrevs.texi
index ff6cdf77c2e..d586d0bbc13 100644
--- a/lispref/abbrevs.texi
+++ b/lispref/abbrevs.texi
@@ -335,10 +335,9 @@ abbrev lookup happens.
@end defvar
The following sample code shows a simple use of
-@code{pre-abbrev-expand-hook}. If the user terminates an abbrev with a
-punctuation character, the hook function asks for confirmation. Thus,
-this hook allows the user to decide whether to expand the abbrev, and
-aborts expansion if it is not confirmed.
+@code{pre-abbrev-expand-hook}. If the user terminates an abbrev with
+a punctuation character, the hook function asks for confirmation. It
+aborts expansion if the user does not confirm.
@smallexample
(add-hook 'pre-abbrev-expand-hook 'query-if-not-space)
@@ -350,12 +349,10 @@ aborts expansion if it is not confirmed.
;; @r{user entered some other character, this function asks whether}
;; @r{expansion should continue.}
-;; @r{If the user answers the prompt with @kbd{y}, the function returns}
-;; @r{@code{nil} (because of the @code{not} function), but that is}
-;; @r{acceptable; the return value has no effect on expansion.}
+;; @r{The function's return value makes no difference.}
(defun query-if-not-space ()
- (if (/= ?\s (preceding-char))
+ (if (/= ?\s last-command-char)
(if (not (y-or-n-p "Do you want to expand this abbrev? "))
(error "Not expanding this abbrev"))))
@end smallexample