Subject: bug#45693: [two word expansion works, but write-abbrev-file destroys it]

From: Uwe Brauer <[email-masked]>
Date: Wed, 13 Jan 2021 10:28:03 +0100

> Uwe Brauer <[email-masked]> writes:

> Yes, perfect, thanks. inverse-add-mode-abbrev tries to add the abbrev
> to 'local-abbrev-table', which is a list here:

> Debugger entered--Lisp error: (wrong-type-argument vectorp ([## 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 a\ que 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 ...] [## 0 0 0 0 0 0 asi 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...]))
>   intern-soft("" ([## 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 a\ que 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...] [## 0 0 0 0
> 0 0 asi 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 ...]))
>   obarray-get(([## 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 a\ que 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...] [## 0 0 0 0 0
> 0 asi 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 ...]) "")
>   abbrev-table-get(([## 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 a\ que 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...] [## 0 0 0
> 0 0 0 asi 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 ...]) :abbrev-table-modiff)
>   define-abbrev(([## 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 a\ que 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...] [## 0 0 0 0
> 0 0 asi 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 ...]) "nacion" "the nation")
>   inverse-add-abbrev(([## 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 a\ que 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...] [## 0 0
> 0 0 0 0 asi 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 ...]) "Mode" 1)
>   inverse-add-mode-abbrev(1)
>   funcall-interactively(inverse-add-mode-abbrev 1)
>   call-interactively(inverse-add-mode-abbrev nil nil)
>   command-execute(inverse-add-mode-abbrev)

> So itʼs explicitly documented that 'local-abbrev-table' can be a
> *list* of abbrev tables, but lots of the abbrev code assumes that
> it gets passed a single table.

> Itʼs easy enough to check for 'consp' in such cases, but then which of
> tables in that list should we add the abbrev to? The first one? All of
> them?

> Iʼm leaning towards "first, and document that you should put the most
> specific table at the front of the list of local abbrev tables", but
> Iʼd welcome opinions from others.

I am not entirely sure, I understand the logic behind this. To give you
a concrete example. (That enters now the flyspell problem).

I have defined for each language I use flypsell/ispell a minor mode and
a corresponding local-abbrev table.

    1. American

    2. British

    3. German

    4. Spanish

    5. French

    6. And even Hebrew (but we can leave that may out for the moment).

Now say I am in latex mode and turn spelling for American on (which in
turn turn the minor mode american-spelling on), is then the local abbrev
table the first in that list?

Uwe