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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: yinz Liu <liuyinz95@HIDDEN>; dated Sat, 17 Dec 2022 03:35:04 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 60143 <at> debbugs.gnu.org:


Received: (at 60143) by debbugs.gnu.org; 19 Dec 2022 16:09:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 19 11:09:23 2022
Received: from localhost ([127.0.0.1]:38958 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p7Ihf-0004Ck-64
	for submit <at> debbugs.gnu.org; Mon, 19 Dec 2022 11:09:23 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:34551)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1p7Ihb-0004CZ-R8
 for 60143 <at> debbugs.gnu.org; Mon, 19 Dec 2022 11:09:22 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 4E4944415B3;
 Mon, 19 Dec 2022 11:09:14 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B9E41440340;
 Mon, 19 Dec 2022 11:09:12 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1671466152;
 bh=0QsdQhQ1CHwcgzLmqzzxtOV41/8ZxPbY970NEUQoX1g=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=dy29OtyGQqQaG+RUxaq+M00pl8IT+zA5gEnKkhtRrIvYIEfUVih/1yJtW/Dmq8azZ
 GJ4COLsDGZ7O/zgHh7r4KinwkU96piU6w8neJqeHOdnn6GGuqbrCnzxU11VpBRSk5F
 zuoHgSTnpVGYfNDeZgjx1O0MXVOHrRhr1/14zJUvZ944RDdEJ7yKSuHpWXbpRO1lND
 ES8A4wXpNJ5glHSKbbWOrNcWQeBV774lihMv7A6AoO0Sxce3LwlF8w+Q5fL9zOILFp
 Q7s8QZH3cEC63W5Jlw32b1qt+Xo8Axkmpcg3FzyHxuRRKkeNur73hbibZqlB3v8A/r
 ZeN3nS0LkK+4A==
Received: from pastel (unknown [45.72.200.228])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 94CEC12025D;
 Mon, 19 Dec 2022 11:09:12 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#60143: 29.0.60; command `undo-redo` don't restore cursor
 position
In-Reply-To: <83y1r4dq0a.fsf@HIDDEN> (Eli Zaretskii's message of "Mon, 19 Dec
 2022 05:35:49 +0200")
Message-ID: <jwvk02nv0mg.fsf-monnier+emacs@HIDDEN>
References: <CA+NXa3gQxcLwT_hTjmd4AMzgnM8-UQ_+y+Dr4prnZLwL9i=PpQ@HIDDEN>
 <83len5ezxs.fsf@HIDDEN> <jwv7cyow5qj.fsf-monnier+emacs@HIDDEN>
 <83y1r4dq0a.fsf@HIDDEN>
Date: Mon, 19 Dec 2022 11:09:09 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.418 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 60143
Cc: liuyinz95@HIDDEN, 60143 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii [2022-12-19 05:35:49] wrote:

>> From: Stefan Monnier <monnier@HIDDEN>
>> Cc: yinz Liu <liuyinz95@HIDDEN>,  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





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60143; Package emacs. Full text available.

Message received at 60143 <at> debbugs.gnu.org:


Received: (at 60143) by debbugs.gnu.org; 19 Dec 2022 03:35:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 18 22:35:51 2022
Received: from localhost ([127.0.0.1]:37532 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p76wR-0004wl-Kh
	for submit <at> debbugs.gnu.org; Sun, 18 Dec 2022 22:35:51 -0500
Received: from eggs.gnu.org ([209.51.188.92]:58960)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1p76wP-0004we-8g
 for 60143 <at> debbugs.gnu.org; Sun, 18 Dec 2022 22:35:49 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1p76wI-00059Q-Du; Sun, 18 Dec 2022 22:35:42 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=nK2VjPxFYd/mP0mx+V/4i2nz6nlpvIdeyZ18svmur7U=; b=lH1SNTkTa8/2
 begV3/Es/TKPhLrrO6Jt80wq23lf5MThL4dQgB+QgArre5LAwCLLfQriWiS34y6nlt5yz1DLwwjP3
 jVvwBf4+2Kxt9b1ljKfooHJdWdIvvSrqDFFSVVsCuBUuQ7/PMUf41IfzhceFlvrkNhlmFQR8hlsdT
 fLcSzhSBE3i133mfBk3EdfBVMeJZdY/GgvmCa1LjIwmPLhk482+cD83aKZBkamo3+QSACnB8JmSdF
 G9bcxR5zbWOLGSVaWtabZFH61C0C+Bhtb14ZvTl1mJoisPbaUhsZx3+f2Vjw0ppncG4O5Oz5q91Yf
 Ox2N2CEJNIgz11dHKkMn1Q==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1p76wF-0001hj-Rt; Sun, 18 Dec 2022 22:35:42 -0500
Date: Mon, 19 Dec 2022 05:35:49 +0200
Message-Id: <83y1r4dq0a.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <jwv7cyow5qj.fsf-monnier+emacs@HIDDEN> (message from Stefan
 Monnier on Sun, 18 Dec 2022 20:42:31 -0500)
Subject: Re: bug#60143: 29.0.60; command `undo-redo` don't restore cursor
 position
References: <CA+NXa3gQxcLwT_hTjmd4AMzgnM8-UQ_+y+Dr4prnZLwL9i=PpQ@HIDDEN>
 <83len5ezxs.fsf@HIDDEN> <jwv7cyow5qj.fsf-monnier+emacs@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 60143
Cc: liuyinz95@HIDDEN, 60143 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Stefan Monnier <monnier@HIDDEN>
> Cc: yinz Liu <liuyinz95@HIDDEN>,  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.  Which is
why 'undo' in that scenario also ends up with point before the
recovered deletion.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60143; Package emacs. Full text available.

Message received at 60143 <at> debbugs.gnu.org:


Received: (at 60143) by debbugs.gnu.org; 19 Dec 2022 01:42:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 18 20:42:41 2022
Received: from localhost ([127.0.0.1]:37049 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p75Av-0003pG-9T
	for submit <at> debbugs.gnu.org; Sun, 18 Dec 2022 20:42:41 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:41230)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1p75At-0003p9-Ml
 for 60143 <at> debbugs.gnu.org; Sun, 18 Dec 2022 20:42:40 -0500
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 546D0100905;
 Sun, 18 Dec 2022 20:42:34 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id EBD491008D0;
 Sun, 18 Dec 2022 20:42:32 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1671414153;
 bh=P9Kfu61H+V7tsBwxWXzp2TxJ1TEiBNFK+3kxLxo0n/o=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=SzfunT0CFFQ7npB+OWP78rCeYyC9TIOXb9DaDi+dD3LI0QqN8GQ4THsVcHFFb0eQr
 mcPTGxGLhFt8B1sfFtYo40jThSKWBhCZb2oQUkJ9AD6+qH93Fsjm9fUsq49KmcqO5P
 17/qKk+RD0rp2y8N2pCiGA9tWS+D+MCLQMURddqu0p8nAs99alMCIwv1RDgRZSjWQk
 ptxqX1XA3h7FOS+X8rBocra31lgbeGoehlcp9fV49OZKhOKawxF7t9o6rLcie+0Pry
 pJ+QjnOy/gQBfPH8FPoHYZMrQoxxZt1tr/QYjoE51+qS341+P7Gfm0w0YXJvOQoYUd
 tLggQd47hkrpw==
Received: from pastel (unknown [45.72.200.228])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BF7521202EE;
 Sun, 18 Dec 2022 20:42:32 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#60143: 29.0.60; command `undo-redo` don't restore cursor
 position
In-Reply-To: <83len5ezxs.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 18 Dec
 2022 13:03:43 +0200")
Message-ID: <jwv7cyow5qj.fsf-monnier+emacs@HIDDEN>
References: <CA+NXa3gQxcLwT_hTjmd4AMzgnM8-UQ_+y+Dr4prnZLwL9i=PpQ@HIDDEN>
 <83len5ezxs.fsf@HIDDEN>
Date: Sun, 18 Dec 2022 20:42:31 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.398 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 60143
Cc: yinz Liu <liuyinz95@HIDDEN>, 60143 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> 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





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60143; Package emacs. Full text available.

Message received at 60143 <at> debbugs.gnu.org:


Received: (at 60143) by debbugs.gnu.org; 18 Dec 2022 11:03:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 18 06:03:45 2022
Received: from localhost ([127.0.0.1]:33296 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p6rSL-0007Ob-HK
	for submit <at> debbugs.gnu.org; Sun, 18 Dec 2022 06:03:45 -0500
Received: from eggs.gnu.org ([209.51.188.92]:34468)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1p6rSK-0007OP-BJ
 for 60143 <at> debbugs.gnu.org; Sun, 18 Dec 2022 06:03:44 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1p6rSD-0001aS-P8; Sun, 18 Dec 2022 06:03:38 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=5RyBX1uB7+1k/qV/duFGeGilXLus2aM33lmcxUpaVlo=; b=rmCes6QiCPGK
 ilfTU/2bT/DDcaeJjKz4Y9HbZw2FS+XvPPX33ouBsGbtL9o2coxClk8ASZ+QbOy8FkWk3oCKKpTrI
 X9uQqc7iYIVQUCrN7qRRe8jbxKeIQsBYj+QRx8h5b8c07wXjWsPmXU+gvkFHLnYUQ6n7wqppOlZ9L
 o7gvzaNYn5IB4s6F7t/DuEJb7m+dScB/K1gjAS92Apw5W4HYCe66Nt31ogtFfdL8UcEL8Baf6tgPt
 +oiwJZh0fsc6OhVAwTPUCAIpUFkSeeWcwrsCSqkJ5PnGdB36dGRhdwvNlozd6WHC4f5mt8Rl3hy3O
 +4vHKwHKKPzLupm6yXRc6g==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1p6rSC-0005vI-F6; Sun, 18 Dec 2022 06:03:37 -0500
Date: Sun, 18 Dec 2022 13:03:43 +0200
Message-Id: <83len5ezxs.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: yinz Liu <liuyinz95@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <CA+NXa3gQxcLwT_hTjmd4AMzgnM8-UQ_+y+Dr4prnZLwL9i=PpQ@HIDDEN>
 (message from yinz Liu on Sat, 17 Dec 2022 09:42:28 +0800)
Subject: Re: bug#60143: 29.0.60;
 command `undo-redo` don't restore cursor position
References: <CA+NXa3gQxcLwT_hTjmd4AMzgnM8-UQ_+y+Dr4prnZLwL9i=PpQ@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 60143
Cc: 60143 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: yinz Liu <liuyinz95@HIDDEN>
> 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?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60143; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 17 Dec 2022 03:34:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 16 22:34:43 2022
Received: from localhost ([127.0.0.1]:53351 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p6NyF-00018Q-Id
	for submit <at> debbugs.gnu.org; Fri, 16 Dec 2022 22:34:43 -0500
Received: from lists.gnu.org ([209.51.188.17]:41154)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <liuyinz95@HIDDEN>) id 1p6MDy-0003gx-0q
 for submit <at> debbugs.gnu.org; Fri, 16 Dec 2022 20:42:50 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <liuyinz95@HIDDEN>)
 id 1p6MDx-0006fj-MC
 for bug-gnu-emacs@HIDDEN; Fri, 16 Dec 2022 20:42:49 -0500
Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <liuyinz95@HIDDEN>)
 id 1p6MDv-00011m-UV
 for bug-gnu-emacs@HIDDEN; Fri, 16 Dec 2022 20:42:49 -0500
Received: by mail-lj1-x22f.google.com with SMTP id v11so3861628ljk.12
 for <bug-gnu-emacs@HIDDEN>; Fri, 16 Dec 2022 17:42:47 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=doEHJxNX8ZdFZliYtkc2pGmQLWv3cBx6/5A4i2MmFIg=;
 b=M47STUy/MyAAXe6ikUBhJf59QIhBiyr+uXpOWBawzGBcYf7v3DvxKWO81UNOg+T9Xs
 cS+M+6judIatoTYbKjs7xXFecsWBAaltI5kKDKuQa0EAJFA/IqjTdrVGHX1GW2OX43fA
 0/sQ3YZfz3VIAaGuIKcZIjfWJCcEHtJYxGsz8+ewtVLc5VMoIuVUKl9a5z8aWrVdYQLa
 APra2Ct6N0vNUb+5XS9MWCVSwnatSotkhirBlLIXwOXAhtBb9IWMnv7eMzmjwWeZjkk3
 sFlar2AXnmzQpD62lCU7Jlwvu+cHk+LpGaoHH1BxHAhvh1glsBWO+YG4C1Or9CVKlj5+
 5Cbg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=doEHJxNX8ZdFZliYtkc2pGmQLWv3cBx6/5A4i2MmFIg=;
 b=Q2zhAEZgEGQFjEjdpa5XPGMs0g5qSHrXSm677wYtH3xpgzuNHmPLLAlWQJWkrI4CJ0
 vk4KeJnp1hrFm2CbEFCmUO/vwukQQqYx0G7VwcKvaKdJDn9cm6tSggnUoft5+wGvoOTb
 CNz8LtgoqLGpa4ThZS0mhXjSyLn4yEDwwdIgKyFIzgcQ96ZtQaP5upvYRjOs2XtazPoM
 W1CRdt2fMNSN+B2AZBvUJmFch6Q9U7C/rgDy51MVzydss4j4Uk26FX7ZJ/MwMnecf6WV
 65c5YpSWTQAqq0e/G2W8HyCwmIT2ey0MwKrvpWE6mekr9imhJHdevwKP/IX8ZDx+R2H8
 5EJg==
X-Gm-Message-State: AFqh2kr0yNlFFuO+dMnoJJUu/ujG+EGBUsA9dYIlj99oOpU+/F3ttS6u
 ABHM7hp/8PMsSjEuINHyrczOQLZ2wpTSOm+/Iu8dKM3TKiyfcA==
X-Google-Smtp-Source: AMrXdXtVGugPfDGK+lO0sQ8XviPSjwJNdOXYeti/Vg4ux+JOgj6fIw1cFX6H1VygrFul1d/tIFjzSQchA1Dey6DXG0U=
X-Received: by 2002:a05:651c:221f:b0:27e:5ba8:cdd1 with SMTP id
 y31-20020a05651c221f00b0027e5ba8cdd1mr375470ljq.142.1671241365127; Fri, 16
 Dec 2022 17:42:45 -0800 (PST)
MIME-Version: 1.0
From: yinz Liu <liuyinz95@HIDDEN>
Date: Sat, 17 Dec 2022 09:42:28 +0800
Message-ID: <CA+NXa3gQxcLwT_hTjmd4AMzgnM8-UQ_+y+Dr4prnZLwL9i=PpQ@HIDDEN>
Subject: 29.0.60; command `undo-redo` don't restore cursor position
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/alternative; boundary="000000000000e707b805effc3336"
Received-SPF: pass client-ip=2a00:1450:4864:20::22f;
 envelope-from=liuyinz95@HIDDEN; helo=mail-lj1-x22f.google.com
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.1 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 16 Dec 2022 22:34:38 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

--000000000000e707b805effc3336
Content-Type: text/plain; charset="UTF-8"

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
<https://github.com/emacs-mirror/emacs/blob/149e6e03b3f860c3d78031bf3377d8a4c99a7a64/lisp/simple.el#L3622-L3624>
 :


change L3624 to : `(goto-char (+ pos (length string)))`

--000000000000e707b805effc3336
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">





<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:no=
rmal;font-family:&quot;Helvetica Neue&quot;">aaaa ! bbbb @ cccc #</p>
<p class=3D"gmail-p2" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:no=
rmal;font-family:&quot;Helvetica Neue&quot;;min-height:15px"><br></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:no=
rmal;font-family:&quot;Helvetica Neue&quot;">1. when cursor at position &qu=
ot;#&quot;, call `undo&#39;, cursor jump to &quot;@&quot;</p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:no=
rmal;font-family:&quot;Helvetica Neue&quot;">2. when cursor at position &qu=
ot;@&quot;, call `undo-redo&#39;, text &quot;cccc&quot; restore,</p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:no=
rmal;font-family:&quot;Helvetica Neue&quot;"><span class=3D"gmail-Apple-con=
verted-space">=C2=A0=C2=A0 </span>but cursor still remain in &quot;@&quot;,=
 don&#39;t move to &quot;#&quot;.</p>
<p class=3D"gmail-p2" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:no=
rmal;font-family:&quot;Helvetica Neue&quot;;min-height:15px"><br></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:no=
rmal;font-family:&quot;Helvetica Neue&quot;">my workaround fow now:</p>
<p class=3D"gmail-p2" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:no=
rmal;font-family:&quot;Helvetica Neue&quot;;min-height:15px"><br></p><p cla=
ss=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-varian=
t-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;f=
ont-family:&quot;Helvetica Neue&quot;">in function=C2=A0<a href=3D"https://=
github.com/emacs-mirror/emacs/blob/149e6e03b3f860c3d78031bf3377d8a4c99a7a64=
/lisp/simple.el#L3622-L3624">primitive-undo</a>=C2=A0:</p><p class=3D"gmail=
-p1" style=3D"margin:0px;font-variant-numeric:normal;font-variant-east-asia=
n:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:=
&quot;Helvetica Neue&quot;"><br></p><p class=3D"gmail-p1" style=3D"margin:0=
px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:=
normal;font-size:13px;line-height:normal;font-family:&quot;Helvetica Neue&q=
uot;">change L3624 to : `(goto-char (+ pos (length string)))`<br></p></div>

--000000000000e707b805effc3336--




Acknowledgement sent to yinz Liu <liuyinz95@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#60143; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 4 Sep 2023 15:15:01 UTC

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