bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Robert Pluim
Subject: bug#45693: [two word expansion works, but write-abbrev-file destroys it]
Date: Wed, 13 Jan 2021 10:16:11 +0100

Uwe Brauer <oub@mat.ucm.es> writes:

> Steps to reproduce (I attach the files for convenience)
>
>     1. Start emacs -Q
>
>     2. Load the patched abbrev.el provided by Robert
>
>     3. Load or execute the following
>
>        a. (setq abbrev-file-name "~/Abbrev-Doble/.abbrev-new_defs") ; or
>           any other path
>
>        b. (read-abbrev-file "~/Abbrev-Doble/.abbrev-double_defs") ; file 
> attached
>
>        c. (setq-default abbrev-mode t)
>
>     4. Open a file in fundamental mode, called say new.
>
>     5. Execute (setq local-abbrev-table (list my-abbrev-table 
> fundamental-mode-abbrev-table))
>
>     6. Check via edit-abbrevs (note: the properties are not displayed by
>        this function! Should that be fixed also?
>
>     7. Check whether the doble expansion works:
>
>        a. Type a que
>
>        b. Indeed it works
>
>     8. Add a local (inverse) abbrev:
>
>        a. Type nacion
>
>        b. Put the cursor at the end of the word
>
>        c. Type C-x a i l
>
>        d. Type nación
>
>        e. The error pops up
>           obarray-get: Wrong type argument: vectorp, ([## 0 0 0 0 0 0 0 0 0 
> ...] [## 0 0 0 0 0 0 0 0 0 ...])
>
>     9. Repeat step 7 but use C-x a i g
>
>        a. No error! Understandable because the global abbrev table does
>           not have properties.
>
> Did I explain that enough?
>

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.

Robert





reply via email to

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