Q: how can I get abbrev tables to inherit properties?
Motivation: I'd like to mix and match abbrevs such that some expand automatically when typing, while others expand only when I explicitly tell them to via
expand-abbrev. (See a previous question on this issue.)
Solution in a simple case: cribbing from the accepted answer on the above question, one can define a single abbrev to expand explicitly with:
(define-abbrev text-mode-abbrev-table "abbrev" "expansion value" nil :enable-function (lambda () (eq this-command 'expand-abbrev)))
Problem: I've got a whole bunch of abbrevs I'd like to use, so doing the above for each one would be tedious. It should be possible to use
define-abbrev-table to automate everything, and then have the actual abbrev tables inherit from them. So, consider the following two tables:
(define-abbrev-table 'automatic-table '(("test1" "This should expand automatically") ;; ... more abbrevs here ("test2" "This should also expand automatically"))) (define-abbrev-table 'explicit-table '(("test3" "This should expand only after expand-abbrev") ;; ... more abbrevs here ("test4" "This should also expand only after expand-abbrev")) :enable-function (lambda () (eq this-command 'expand-abbrev)))
It seems like it should then be possible to do the following:
(define-abbrev-table 'text-mode-abbrev-table nil "Table's docstring" :parents (list explicit-table automatic-table))
It does not quite work out, however.
text-mode-abbrev-table correctly inherits the abbrevs defined in
explicit-table, but they always fire automatically when typing. In other words, the
:enable-function property on
explicit-table gets ignored.
How can I ensure that the
:enable-function property gets inherited for the abbrevs in the relevant table without being applied to abbrevs in a different table?