[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: abbrev-expand-functions
From: |
Leo |
Subject: |
Re: abbrev-expand-functions |
Date: |
Sun, 15 Mar 2009 13:05:52 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
On 2009-03-13 20:24 +0000, Johan Bockgård wrote:
> Leo <sdl.web@gmail.com> writes:
>
>> On 2009-03-04 15:22 +0000, Leo wrote:
>>> But according to the manual, it seems this is only possible by defining
>>> the abbreviation with a 'no-self-insert hook. This is not an option to
>>> me as I want my function to be general for all abbreviations.
>>>
>>> Any idea how to get this done?
>>
>> Any elisp gurus that can offer some help to question? Thank you.
>
> ;;; For Emacs 23
>
> (fset 'my-no-self-insert 'my-no-self-insert-hook)
> (put 'my-no-self-insert-hook 'no-self-insert t)
>
> (defun my-abbrev-expand-function (expander)
> (and
> ;; The normal expansion.
> (funcall expander)
> ;; Return a symbol whose symbol-function has a non-nil
> ;; `no-self-insert' property.
> 'my-no-self-insert))
>
> (add-hook 'abbrev-expand-functions 'my-abbrev-expand-function)
>
>
> Note that no-self-insert interacts strangely with RET.
This is brilliant!
Since the return value has a symbol-function, how is that
symbol-function being used in abbrev? I am asking this in hope to
understand better the consequences of setting it to a real function.
Is the following understanding correct?
Internally, each abbrev symbol is like an uninterned variable with a
structure like this:
(ABBREVNAME EXPANSION [HOOK] [PROPS...])
the symbol's each property maps to a slot in that structure, for
example, symbol-function maps to [HOOK] etc.
If the above is correct, where to find an exhaustive list of these
mappings? This will allow me to adjust other properties that may come up
in future.
Thank you very much.
--
.: Leo :. [ sdl.web AT gmail.com ] .: I use Emacs :.
www.git-scm.com
git - the one true version control system