unofficial mirror of emacs-devel@gnu.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

* Re: Is there a reason why abbrev-table properties are not saved in file
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Noam Postavsky @ 2018-06-26 14:21 UTC (permalink / raw)
  To: Anders Johansson; +Cc: Emacs developers

On 26 June 2018 at 09:51, Anders Johansson <mejlaandersj@gmail.com> wrote:

> Apparently write-abbrev-file doesn’t include properties for neither
> abbrev-tables nor individual abbrevs.

I think this is Bug#29924 which should be fixed in master.

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=29924



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

* Re: Is there a reason why abbrev-table properties are not saved in file
  2018-06-26 14:21 ` Noam Postavsky
@ 2018-06-26 15:43   ` Anders Johansson
  2018-06-26 16:52     ` Noam Postavsky
  0 siblings, 1 reply; 4+ messages in thread
From: Anders Johansson @ 2018-06-26 15:43 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Emacs developers



> 26 juni 2018 kl. 16:21 skrev Noam Postavsky <npostavs@gmail.com>:
> 
> I think this is Bug#29924 which should be fixed in master.
> 
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=29924

Oh! Forgot to search among the bugs!

The patch for Bug#29924 only seems to write properties for individual abbrevs and not each abbrev-table however (if I read it correctly), so it wouldn’t fix my use case of assigning an :enable-function property to the whole table.

/Anders Johansson


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

* Re: Is there a reason why abbrev-table properties are not saved in file
  2018-06-26 15:43   ` Anders Johansson
@ 2018-06-26 16:52     ` Noam Postavsky
  0 siblings, 0 replies; 4+ messages in thread
From: Noam Postavsky @ 2018-06-26 16:52 UTC (permalink / raw)
  To: Anders Johansson; +Cc: Emacs developers

On 26 June 2018 at 11:43, Anders Johansson <mejlaandersj@gmail.com> wrote:

> The patch for Bug#29924 only seems to write properties for individual abbrevs and not each abbrev-table however (if I read it correctly), so it wouldn’t fix my use case of assigning an :enable-function property to the whole table.

Ah, I missed that distinction, yes that looks like it's still broken.
I guess there's no reason not to support it except that nobody has
done it yet.

A couple more related bugs listed in
https://debbugs.gnu.org/cgi/pkgreport.cgi?include=subject%3Aabbrevs;package=emacs

#30508: 25.3; edit-abbrevs does not support abbrev properties like :case-fixed
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30508
#23891: define-abbrevs - property args not accessible
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=29924



^ 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 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).