--- Begin Message ---
Subject: |
define-abbrev with EXPANSION equal to nil doesn't run the abbrev hook |
Date: |
Fri, 17 Oct 2008 15:25:59 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (windows-nt) |
The docstring for define-abbrev says:
(define-abbrev table name expansion &optional hook &rest props)
Define an abbrev in table named name, to expand to expansion and call hook.
[...]
If expansion is not a string, the abbrev is a special one,
which does not expand in the usual way but only runs hook.
It seems that EXPANSION must be the empty string for the special
behavior described in the docstring to happen. To reproduce this,
evaluate this form:
(progn
(define-abbrev global-abbrev-table "zzz" nil '(lambda () (message "Hello")))
(define-abbrev global-abbrev-table "yyy" "" '(lambda () (message "Hello")))
(switch-to-buffer "temp"))
and then type " zzz yyy ". The "zzz" abbrev does cause the hook to run,
but the "yyy" abbrev causes the hook to run.
--
Fran
--- End Message ---
--- Begin Message ---
Subject: |
Re: define-abbrev with EXPANSION equal to nil doesn't run the abbrev hook |
Date: |
Fri, 17 Oct 2008 17:27:36 -0400 |
> The docstring for define-abbrev says:
>
> (define-abbrev table name expansion &optional hook &rest props)
>
> Define an abbrev in table named name, to expand to expansion and call hook.
> [...]
> If expansion is not a string, the abbrev is a special one,
> which does not expand in the usual way but only runs hook.
>
> It seems that EXPANSION must be the empty string for the special
> behavior described in the docstring to happen. To reproduce this,
> evaluate this form:
>
> (progn
> (define-abbrev global-abbrev-table "zzz" nil '(lambda () (message
> "Hello")))
> (define-abbrev global-abbrev-table "yyy" "" '(lambda () (message
> "Hello")))
> (switch-to-buffer "temp"))
>
> and then type " zzz yyy ". The "zzz" abbrev does cause the hook to run,
> but the "yyy" abbrev causes the hook to run.
When EXPANSION is nil, that undefines the abbrev. This is mentioned
earlier in the docstring of define-abbrev. I made a small change to the
docstring to make this clearer.
--- End Message ---