all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Is there a reason why abbrev-table properties are not saved in file
@ 2018-06-26 13:51 Anders Johansson
  2018-06-26 14:21 ` Noam Postavsky
  0 siblings, 1 reply; 4+ messages in thread
From: Anders Johansson @ 2018-06-26 13:51 UTC (permalink / raw)
  To: emacs-devel

Hi,
I recently wrote up some code for using different abbrev-tables 
for different languages.
It boils down to two custom abbrev-tables in my abbrev file and 
using some functions to determine if a language is active 
(essentially checking ispell-local-dictionary) as enable-functions 
for these tables.

However, this means I have to put properties on the tables every 
time I load the abbrev file:

(with-eval-after-load abbrev-file-name
    (abbrev-table-put aj/english-abbrevs :enable-function 
    #'aj/writing-english-p)
    (abbrev-table-put aj/swedish-abbrevs :enable-function 
    #'aj/writing-swedish-p)
    (abbrev-table-put text-mode-abbrev-table
                      :parents (list aj/english-abbrevs 
                      aj/swedish-abbrevs)))

I initially did try to store these properties in the abbrev file, 
but that was overwritten whenever abbrevs were edited and saved.

Apparently write-abbrev-file doesn’t include properties for 
neither abbrev-tables nor individual abbrevs.
With my quick check through abbrev.el it appears that this could 
be easily added at the end of insert-abbrev-table-description and 
for individual symbols.

Since both define-abbrev and define-abbrev-table supports adding 
properties as &rest arguments this shouldn’t be so complicated.
I guess this would involve filtering out the relevant properties 
to store from what is returned by symbol-plist.

But perhaps there is a  good reason for the present state that I 
missed?

By the way, the last form in my code above would have to remain, 
as the :parent property has to be a list of abbrev-tables (which 
are themselves loaded from the file) and not only their names.

-- 
Anders Johansson



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-26 16:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-26 13:51 Is there a reason why abbrev-table properties are not saved in file Anders Johansson
2018-06-26 14:21 ` Noam Postavsky
2018-06-26 15:43   ` Anders Johansson
2018-06-26 16:52     ` Noam Postavsky

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.