unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Anders Johansson <mejlaandersj@gmail.com>
To: emacs-devel@gnu.org
Subject: Is there a reason why abbrev-table properties are not saved in file
Date: Tue, 26 Jun 2018 15:51:32 +0200	[thread overview]
Message-ID: <87sh597j17.fsf@gmail.com> (raw)

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



             reply	other threads:[~2018-06-26 13:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-26 13:51 Anders Johansson [this message]
2018-06-26 14:21 ` Is there a reason why abbrev-table properties are not saved in file Noam Postavsky
2018-06-26 15:43   ` Anders Johansson
2018-06-26 16:52     ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sh597j17.fsf@gmail.com \
    --to=mejlaandersj@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).