[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#36516: Wrong dynamic abbrev expansion after space
From: |
Alan Third |
Subject: |
bug#36516: Wrong dynamic abbrev expansion after space |
Date: |
Sat, 27 Jul 2019 11:26:38 +0100 |
User-agent: |
Mutt/1.12.0 (2019-05-25) |
On Wed, Jul 24, 2019 at 12:15:16AM +0300, Juri Linkov wrote:
> >> 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.
I remembered writing that test and checked previously. It’s not
exactly the same recipe. That one was where there were two spaces and
subsequent calls to dabbrev-expand would replace the wrong text with
the correct expansion, not replace the correct text with the wrong
expansion.
I hope that makes sense... A bit more info here:
https://lists.gnu.org/archive/html/emacs-devel/2016-01/msg01721.html
--
Alan Third
- bug#36516: Wrong dynamic abbrev expansion after space, (continued)
- bug#36516: Wrong dynamic abbrev expansion after space, Eli Zaretskii, 2019/07/05
- bug#36516: Wrong dynamic abbrev expansion after space, Juri Linkov, 2019/07/07
- bug#36516: Wrong dynamic abbrev expansion after space, Eli Zaretskii, 2019/07/07
- bug#36516: Wrong dynamic abbrev expansion after space, Juri Linkov, 2019/07/08
- bug#36516: Wrong dynamic abbrev expansion after space, Eli Zaretskii, 2019/07/13
- bug#36516: Wrong dynamic abbrev expansion after space, Alan Third, 2019/07/27
- bug#36516: Wrong dynamic abbrev expansion after space, Juri Linkov, 2019/07/28
bug#36516: Wrong dynamic abbrev expansion after space, Noam Postavsky, 2019/07/22