From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: liuyinz95@gmail.com, 60143@debbugs.gnu.org
Subject: bug#60143: 29.0.60; command `undo-redo` don't restore cursor position
Date: Mon, 19 Dec 2022 05:35:49 +0200 [thread overview]
Message-ID: <83y1r4dq0a.fsf@gnu.org> (raw)
In-Reply-To: <jwv7cyow5qj.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Sun, 18 Dec 2022 20:42:31 -0500)
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: yinz Liu <liuyinz95@gmail.com>, 60143@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. Which is
why 'undo' in that scenario also ends up with point before the
recovered deletion.
next prev parent reply other threads:[~2022-12-19 3:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-17 1:42 bug#60143: 29.0.60; command `undo-redo` don't restore cursor position yinz Liu
2022-12-18 11:03 ` Eli Zaretskii
2022-12-19 1:42 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-19 3:35 ` Eli Zaretskii [this message]
2022-12-19 16:09 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83y1r4dq0a.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=60143@debbugs.gnu.org \
--cc=liuyinz95@gmail.com \
--cc=monnier@iro.umontreal.ca \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).