From: Eli Zaretskii <eliz@gnu.org>
To: yinz Liu <liuyinz95@gmail.com>,
Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 60143@debbugs.gnu.org
Subject: bug#60143: 29.0.60; command `undo-redo` don't restore cursor position
Date: Sun, 18 Dec 2022 13:03:43 +0200 [thread overview]
Message-ID: <83len5ezxs.fsf@gnu.org> (raw)
In-Reply-To: <CA+NXa3gQxcLwT_hTjmd4AMzgnM8-UQ_+y+Dr4prnZLwL9i=PpQ@mail.gmail.com> (message from yinz Liu on Sat, 17 Dec 2022 09:42:28 +0800)
> From: yinz Liu <liuyinz95@gmail.com>
> Date: Sat, 17 Dec 2022 09:42:28 +0800
>
> aaaa ! bbbb @ cccc #
>
> 1. when cursor at position "#", call `undo', cursor jump to "@"
>
> 2. when cursor at position "@", call `undo-redo', text "cccc" restore,
> but cursor still remain in "@", don't move to "#".
>
> my workaround fow now:
>
> in function primitive-undo :
>
> change L3624 to : `(goto-char (+ pos (length string)))`
That code is there for almost 10 years, and before that the C
implementation did the same. The way the code is written, viz.:
(goto-char pos)
(insert string)
(goto-char pos))
it is clear that the second goto-char is on purpose, since if we
delete it, we get the effect that you want; no need to goto anywhere
else, because 'insert' leaves point after the inserted text.
So I very much hesitate to change this. Stefan, any comments? do you
happen to know why we return point to before the insertion?
next prev parent reply other threads:[~2022-12-18 11:03 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 [this message]
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
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=83len5ezxs.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).