unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: yinz Liu <liuyinz95@gmail.com>, 60143@debbugs.gnu.org
Subject: bug#60143: 29.0.60; command `undo-redo` don't restore cursor position
Date: Sun, 18 Dec 2022 20:42:31 -0500	[thread overview]
Message-ID: <jwv7cyow5qj.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83len5ezxs.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 18 Dec 2022 13:03:43 +0200")

> 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.


        Stefan






  reply	other threads:[~2022-12-19  1:42 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 [this message]
2022-12-19  3:35     ` Eli Zaretskii
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=jwv7cyow5qj.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=60143@debbugs.gnu.org \
    --cc=eliz@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).