[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Testing new abbrev tables in elisp

From: Juri Linkov
Subject: Re: Testing new abbrev tables in elisp
Date: Wed, 31 Oct 2007 18:09:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

>> Beside of case-sensitivity another theme is in the
>> pipe: to allow multi-word abbrevs.
> Since I've installed my code this is now possible.  Just set the :regexp
> property of the abbrev table accordingly.

It's easy to write such code now to do this indeed, thanks.
For example,

    (defvar dict
      '(("multi-word abbrev" "multi-word expansion")
        ;; ...
    (dolist (d dict)
      (define-abbrev global-abbrev-table (car d) (cadr d)))
    (abbrev-table-put global-abbrev-table
      :regexp (regexp-opt (mapcar 'car dict) 'words))

But maybe abbrev-mode should try to update :regexp automatically when the
user interactively defines a new multi-word abbrev?  So instead of giving
the error message "Some abbrev characters are not word constituents" it
could run something like:

    (let ((abbrevs ()))
      (mapatoms (lambda (sym)
                  (if (symbol-value sym) (push (symbol-name sym) abbrevs)))
      (abbrev-table-put global-abbrev-table :regexp (regexp-opt abbrevs 

to rebuild :regexp from all abbrevs when at least one of them is not
word constituent?

Juri Linkov

reply via email to

[Prev in Thread] Current Thread [Next in Thread]