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

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

bug#36516: Wrong dynamic abbrev expansion after space


From: Juri Linkov
Subject: bug#36516: Wrong dynamic abbrev expansion after space
Date: Wed, 24 Jul 2019 00:15:16 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

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

Thanks for investigating this.  Out of curiosity, I checked now
the test directory, and here it is: test/lisp/dabbrev-tests.el -
the already existing test with exactly the same recipe as in my report.
But for some reason this test doesn't fail.





reply via email to

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