From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60143: 29.0.60; command `undo-redo` don't restore cursor position Date: Mon, 19 Dec 2022 05:35:49 +0200 Message-ID: <83y1r4dq0a.fsf@gnu.org> References: <83len5ezxs.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29753"; mail-complaints-to="usenet@ciao.gmane.io" Cc: liuyinz95@gmail.com, 60143@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 19 04:36:25 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 1p76wz-0007Vl-5Q for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Dec 2022 04:36:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p76wd-0004tH-Ga; Sun, 18 Dec 2022 22:36:03 -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 1p76wc-0004t1-IS for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 22:36: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 1p76wc-0005CE-02 for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 22:36:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p76wb-0004wz-MB for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 22:36:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Dec 2022 03:36: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.167142095219023 (code B ref 60143); Mon, 19 Dec 2022 03:36:01 +0000 Original-Received: (at 60143) by debbugs.gnu.org; 19 Dec 2022 03:35:52 +0000 Original-Received: from localhost ([127.0.0.1]:37532 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p76wR-0004wl-Kh for submit@debbugs.gnu.org; Sun, 18 Dec 2022 22:35:51 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58960) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p76wP-0004we-8g for 60143@debbugs.gnu.org; Sun, 18 Dec 2022 22:35:49 -0500 Original-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 ) 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==; Original-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 ) id 1p76wF-0001hj-Rt; Sun, 18 Dec 2022 22:35:42 -0500 In-Reply-To: (message from Stefan Monnier on Sun, 18 Dec 2022 20:42:31 -0500) 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:251395 Archived-At: > From: Stefan Monnier > Cc: yinz Liu , 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.