GNU bug report logs - #60143
29.0.60; command `undo-redo` don't restore cursor position

Previous Next

Package: emacs;

Reported by: yinz Liu <liuyinz95 <at> gmail.com>

Date: Sat, 17 Dec 2022 03:35:04 UTC

Severity: wishlist

Found in version 29.0.60

Full log


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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: liuyinz95 <at> gmail.com, 60143 <at> debbugs.gnu.org
Subject: Re: bug#60143: 29.0.60; command `undo-redo` don't restore cursor
 position
Date: Mon, 19 Dec 2022 11:09:09 -0500
Eli Zaretskii [2022-12-19 05:35:49] wrote:

>> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
>> Cc: yinz Liu <liuyinz95 <at> gmail.com>,  60143 <at> debbugs.gnu.org
>> Date: Sun, 18 Dec 2022 20:42:31 -0500
>> 
>> > So I very much hesitate to change this.  Stefan, any comments?
>> 
>> Changing that code is likely wrong, indeed.  If the undo doesn't get
>> you where you expected, it should usually be changed by adding an
>> additional record to the undo log.
>> 
>> That "record" is a simple integer indicating the position of point at
>> that moment (citing `C-h o buffer-undo-list`):
>> 
>>     An entry of the form POSITION indicates that point was at the buffer
>>     location given by the integer.  Undoing an entry of this form places
>>     point at POSITION.
>> 
>> As for whether we should add such a record in the OP's scenario, and how
>> to do that, I haven't looked at his scenario in enough detail to have
>> much to say about it.
>
> I don't think we record position of point before deletion.

I think we do, at least sometimes:

    record_delete (ptrdiff_t beg, Lisp_Object string, bool record_markers)
    {
      [...]
      record_point (beg);


-- Stefan





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

Previous Next


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