unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Uwe Brauer <oub@mat.ucm.es>
Cc: larsi@gnus.org, 45693@debbugs.gnu.org
Subject: bug#45693: [two word expansion works, but write-abbrev-file destroys it]
Date: Wed, 13 Jan 2021 10:16:11 +0100	[thread overview]
Message-ID: <87o8htqjs4.fsf@gmail.com> (raw)
In-Reply-To: <87h7nl2spr.fsf@mat.ucm.es> (Uwe Brauer's message of "Wed, 13 Jan 2021 08:37:04 +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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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	other threads:[~2021-01-13  9:16 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06 15:54 bug#45693: 28.0.50; abbrev does not expand two words any more Uwe Brauer
2021-01-10 14:35 ` Lars Ingebrigtsen
2021-01-10 15:51   ` Uwe Brauer
2021-01-10 15:52     ` Lars Ingebrigtsen
2021-01-10 17:22       ` Uwe Brauer
2021-01-10 21:21       ` bug#45693: [two word expansion works, but write-abbrev-file destroys it] (was: bug#45693: 28.0.50; abbrev does not expand two words any more) Uwe Brauer
2021-01-11 10:49         ` bug#45693: [two word expansion works, but write-abbrev-file destroys it] Robert Pluim
2021-01-11 15:26           ` Eli Zaretskii
2021-01-11 15:50             ` Uwe Brauer
2021-01-11 17:38               ` Robert Pluim
2021-01-11 20:17                 ` Uwe Brauer
2021-01-11 20:38                   ` Robert Pluim
2021-01-11 20:48                     ` Uwe Brauer
2021-01-11 21:03                       ` Robert Pluim
2021-01-12  8:01                         ` Uwe Brauer
2021-01-12 10:34                           ` Robert Pluim
2021-01-12 13:26                             ` Uwe Brauer
2021-01-12 16:45                             ` Uwe Brauer
2021-01-12 17:59                               ` Robert Pluim
2021-01-13  7:37                                 ` Uwe Brauer
2021-01-13  9:16                                   ` Robert Pluim [this message]
2021-01-13  9:28                                     ` Uwe Brauer
2021-01-13  9:39                                       ` Robert Pluim
2021-01-13  9:51                                         ` Uwe Brauer
2021-01-13 10:09                                           ` Robert Pluim
2021-01-13 13:18                                             ` Uwe Brauer
2021-01-13 14:03                                               ` Robert Pluim
2021-01-13 16:25                                                 ` Uwe Brauer

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=87o8htqjs4.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=45693@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=oub@mat.ucm.es \
    /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).