all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Juri Linkov <juri@linkov.net>
Cc: 36516@debbugs.gnu.org, Noam Postavsky <npostavs@gmail.com>
Subject: bug#36516: Wrong dynamic abbrev expansion after space
Date: Sat, 27 Jul 2019 11:26:38 +0100	[thread overview]
Message-ID: <20190727102638.GB80460@breton.holly.idiocy.org> (raw)
In-Reply-To: <87zhl4tpuj.fsf@mail.linkov.net>

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





      parent reply	other threads:[~2019-07-27 10:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-05 18:38 bug#36516: Wrong dynamic abbrev expansion after space Juri Linkov
2019-07-05 19:23 ` Eli Zaretskii
2019-07-07 22:13   ` Juri Linkov
2019-07-08  2:33     ` Eli Zaretskii
2019-07-08 21:35       ` Juri Linkov
2019-07-13  8:10         ` Eli Zaretskii
2019-07-27 17:18         ` Alan Third
2019-07-28 20:47           ` Juri Linkov
2019-08-03 11:34             ` Alan Third
2019-08-03 20:58               ` Juri Linkov
2020-08-22 14:18                 ` Lars Ingebrigtsen
2020-08-23 18:43                   ` Juri Linkov
2019-07-22 15:34 ` Noam Postavsky
2019-07-23 21:15   ` Juri Linkov
2019-07-23 21:27     ` Noam Postavsky
2019-07-27 10:26     ` Alan Third [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190727102638.GB80460@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=36516@debbugs.gnu.org \
    --cc=juri@linkov.net \
    --cc=npostavs@gmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.