GNU bug report logs - #36516
Wrong dynamic abbrev expansion after space

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Fri, 5 Jul 2019 19:14:02 UTC

Severity: minor

Full log


Message #25 received at 36516 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 36516 <at> debbugs.gnu.org
Subject: Re: bug#36516: Wrong dynamic abbrev expansion after space
Date: Mon, 22 Jul 2019 11:34:37 -0400
Juri Linkov <juri <at> linkov.net> writes:

> 2. On the third line type:
>  s                      ;; self-insert-command
>  M-/                    ;; dabbrev-expand
>  SPC                    ;; self-insert-command
>  M-/                    ;; dabbrev-expand
>  M-/                    ;; dabbrev-expand
> 3. The word after "str " is expanded to some random word.

It's due to this code in dabbrev.el:

(defun dabbrev-expand (arg)
   ...
        ;; If the user inserts a space after expanding
        ;; and then asks to expand again, always fetch the next word.
        (if (and (eq (preceding-char) ?\s)
                 (markerp dabbrev--last-abbrev-location)
                 (marker-position dabbrev--last-abbrev-location)
                 (= (point) (1+ dabbrev--last-abbrev-location)))
            (progn
              ;; The "abbrev" to expand is just the space.
              (setq abbrev " ")
              ...

This triggers on the second M-/ in your recipe above, which causes the
third M-/ to expand " " instead of "str ".  Not sure what to do about it
though.  Removing this `if' will fix your case, but probably break
others.





This bug report was last modified 4 years and 296 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.