/[emacs]/emacs/lispref/abbrevs.texi
ViewVC logotype

Diff of /emacs/lispref/abbrevs.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16.2.1 by miles, Mon Apr 19 07:01:40 2004 UTC revision 1.16.2.2 by miles, Fri Jul 23 04:30:39 2004 UTC
# Line 335  abbrev lookup happens. Line 335  abbrev lookup happens.
335  @end defvar  @end defvar
336    
337    The following sample code shows a simple use of    The following sample code shows a simple use of
338  @code{pre-abbrev-expand-hook}.  If the user terminates an abbrev with a  @code{pre-abbrev-expand-hook}.  If the user terminates an abbrev with
339  punctuation character, the hook function asks for confirmation.  Thus,  a punctuation character, the hook function asks for confirmation.  It
340  this hook allows the user to decide whether to expand the abbrev, and  aborts expansion if the user does not confirm.
 aborts expansion if it is not confirmed.  
341    
342  @smallexample  @smallexample
343  (add-hook 'pre-abbrev-expand-hook 'query-if-not-space)  (add-hook 'pre-abbrev-expand-hook 'query-if-not-space)
# Line 350  aborts expansion if it is not confirmed. Line 349  aborts expansion if it is not confirmed.
349  ;; @r{user entered some other character, this function asks whether}  ;; @r{user entered some other character, this function asks whether}
350  ;; @r{expansion should continue.}  ;; @r{expansion should continue.}
351    
352  ;; @r{If the user answers the prompt with @kbd{y}, the function returns}  ;; @r{The function's return value makes no difference.}
 ;; @r{@code{nil} (because of the @code{not} function), but that is}  
 ;; @r{acceptable; the return value has no effect on expansion.}  
353    
354  (defun query-if-not-space ()  (defun query-if-not-space ()
355    (if (/= ?\s  (preceding-char))    (if (/= ?\s last-command-char)
356        (if (not (y-or-n-p "Do you want to expand this abbrev? "))        (if (not (y-or-n-p "Do you want to expand this abbrev? "))
357            (error "Not expanding this abbrev"))))            (error "Not expanding this abbrev"))))
358  @end smallexample  @end smallexample

Legend:
Removed from v.1.16.2.1  
changed lines
  Added in v.1.16.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26