From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#60143: 29.0.60; command `undo-redo` don't restore cursor position Date: Sun, 18 Dec 2022 20:42:31 -0500 Message-ID: References: <83len5ezxs.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32773"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: yinz Liu , 60143@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 19 02:43:16 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p75BT-0008L9-41 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Dec 2022 02:43:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p75BI-0003Nd-Dp; Sun, 18 Dec 2022 20:43:04 -0500 Original-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 ) id 1p75BG-0003NP-Nl for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 20:43:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p75BG-0004E5-GC for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 20:43:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p75BF-0003pW-U7 for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 20:43:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Dec 2022 01:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60143 X-GNU-PR-Package: emacs Original-Received: via spool by 60143-submit@debbugs.gnu.org id=B60143.167141416114714 (code B ref 60143); Mon, 19 Dec 2022 01:43:01 +0000 Original-Received: (at 60143) by debbugs.gnu.org; 19 Dec 2022 01:42:41 +0000 Original-Received: from localhost ([127.0.0.1]:37049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p75Av-0003pG-9T for submit@debbugs.gnu.org; Sun, 18 Dec 2022 20:42:41 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:41230) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p75At-0003p9-Ml for 60143@debbugs.gnu.org; Sun, 18 Dec 2022 20:42:40 -0500 Original-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) Original-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== Original-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) In-Reply-To: <83len5ezxs.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 18 Dec 2022 13:03:43 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:251389 Archived-At: > 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