GNU bug report logs - #45029
27.1.50; Regression: Yanking into externally modified file with delete-selection-mode

Previous Next

Package: emacs;

Reported by: Lars Ljung <lars <at> matholka.se>

Date: Thu, 3 Dec 2020 20:11:02 UTC

Severity: normal

Tags: confirmed, fixed

Found in version 27.1.50

Fixed in version 27.2

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: 45029 <at> debbugs.gnu.org
Subject: bug#45029: 27.1.50; Regression: Yanking into externally modified file with delete-selection-mode
Date: Wed, 13 Sep 2023 13:59:55 -0400
Stefan Monnier [2023-09-13 13:36:54] wrote:

> Here is a brief trace that explains the cause of the problem:
>
> 1. C-y (yank) calls delete-selection-pre-hook from pre-command-hook
> 2. delete-selection-helper calls delete-active-region
> 3. this activates ask-user-about-supersession-threat on a modified file
> 4. it calls read-char-from-minibuffer ('this-command' is still 'yank')
> 5. read-char-from-minibuffer waits when user types 'y'
>    (bound to the command 'read-char-from-minibuffer-insert-char')
> 6. after typing 'y', read-char-from-minibuffer returns 'y', but
>    now 'this-command' is 'read-char-from-minibuffer-insert-char'
> 7. when delete-selection-pre-hook finishes, due to 'this-command'
>    'read-char-from-minibuffer-insert-char' is called again,
>    and this time operates on the buffer as if it's the minibuffer

Yuck!
And thanks for the investigation.

> Anyway, here is a patch with two fixes:
> 1. Guards read-char-from-minibuffer-insert-char against inadvertent
>    operating on the non-minibuffer buffer;

I suspect this will/would just hide a problem (such as the current one)
under the rug.

> 2. Prevents read-char-from-minibuffer from changing the value of
>    'this-command' by read-from-minibuffer:

Right, but I think that this needs to apply to all recursive edits
rather than only `read-char-from-minibuffer`.


         Stefan





This bug report was last modified 1 year and 300 days ago.

Previous Next


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