From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#16411: undo-only bugs Date: Fri, 10 Jan 2014 23:29:14 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1389414618 10880 80.91.229.3 (11 Jan 2014 04:30:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 11 Jan 2014 04:30:18 +0000 (UTC) Cc: 16411@debbugs.gnu.org To: Barry OReilly Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 11 05:30:24 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W1qDG-0007bH-HV for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Jan 2014 05:30:22 +0100 Original-Received: from localhost ([::1]:60093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1qDG-0001fN-3P for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Jan 2014 23:30:22 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1qD5-0001fA-OK for bug-gnu-emacs@gnu.org; Fri, 10 Jan 2014 23:30:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1qCy-0001ZP-BL for bug-gnu-emacs@gnu.org; Fri, 10 Jan 2014 23:30:11 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60134) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1qCy-0001Yv-7p for bug-gnu-emacs@gnu.org; Fri, 10 Jan 2014 23:30:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W1qCx-0002DI-Le for bug-gnu-emacs@gnu.org; Fri, 10 Jan 2014 23:30:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Jan 2014 04:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16411 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16411-submit@debbugs.gnu.org id=B16411.13894145588412 (code B ref 16411); Sat, 11 Jan 2014 04:30:03 +0000 Original-Received: (at 16411) by debbugs.gnu.org; 11 Jan 2014 04:29:18 +0000 Original-Received: from localhost ([127.0.0.1]:45920 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1qCE-0002Bc-2N for submit@debbugs.gnu.org; Fri, 10 Jan 2014 23:29:18 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:48528) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1qCB-0002BR-U1 for 16411@debbugs.gnu.org; Fri, 10 Jan 2014 23:29:16 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFxKG9/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLLQcSFBgNJC6HcAbBLY1VgzUDiGGcGYFegxWBUYEy X-IPAS-Result: Av4EABK/CFFFxKG9/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLLQcSFBgNJC6HcAbBLY1VgzUDiGGcGYFegxWBUYEy X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="44708489" Original-Received: from 69-196-161-189.dsl.teksavvy.com (HELO pastel.home) ([69.196.161.189]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 10 Jan 2014 23:29:14 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 540306045A; Fri, 10 Jan 2014 23:29:14 -0500 (EST) In-Reply-To: (Barry OReilly's message of "Fri, 10 Jan 2014 22:48:34 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:83269 Archived-At: >> undo-in-region does not implement undo-only, indeed. I think the way >> to implement undo-only is to change undo-make-selective-list so it >> also skips redo entries (depending on undo-no-redo, obviously) using >> the above while loop. > I don't see how that's a correct solution in the face of arbitrary > regional undos and prefix args. Would you have the redo records > resulting from regional undos still map to t in the undo-equiv-table? I was talking about simply making undo-in-region properly skip the previous undos (presuming they don't themselves come from an undo-in-region). IIUC, you're talking of skipping (e.g. in a non-region undo) the undos that took place during undo-in-region, right? If so, I don't have an answer for how we could do that, in general. In your pseudo-code: While pending-undo-list non nil: Pop undo-i from pending-undo-list: If undo-i is a redo record (exists in the table): Remove undo-i's undone records from pending-undo-list (or otherwise arrange to skip it) Else: Undo undo-i If "undo undo-i" was done prefix-arg times: Break (finished) Reached end of undo history I have no idea how to implement the part: Remove undo-i's undone records from pending-undo-list (or otherwise arrange to skip it) I guess I do have some idea how to do it, but it looks like a lot of work, since we have to adjust the positions in the rest of pending-undo-list. Other than that I don't understand what your redo-record-table does. AFAICT the test "undo-i is a redo record" can be performed with undo-equiv-table. > How does your solution account for redo records that undid several > because of prefix-arg? As you have discovered the current code does not even try to account for prefix args. > undo-equiv-table only maps to the change group > after the last undone record without information about the (1- > prefix-arg) others. Right: the loop that undoes N steps (either in undo-more or in undo if we change undo to only call undo-more with a 1) needs not only to use undo-equiv-table at each iteration to skip redo entries, but it also needs to add an entry in undo-equiv-table at each iteration. Stefan