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#16818: Acknowledgement (Undo in region after markers in undo history relocated) Date: Wed, 12 Mar 2014 19:24:45 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1394666714 4433 80.91.229.3 (12 Mar 2014 23:25:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Mar 2014 23:25:14 +0000 (UTC) Cc: 16818@debbugs.gnu.org To: Barry OReilly Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 13 00:25:21 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 1WNsWW-0000Wt-UV for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Mar 2014 00:25:21 +0100 Original-Received: from localhost ([::1]:35451 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNsWW-0006VI-HH for geb-bug-gnu-emacs@m.gmane.org; Wed, 12 Mar 2014 19:25:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNsWM-0006KT-AW for bug-gnu-emacs@gnu.org; Wed, 12 Mar 2014 19:25:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNsWF-0001p0-1O for bug-gnu-emacs@gnu.org; Wed, 12 Mar 2014 19:25:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNsWE-0001oW-TX for bug-gnu-emacs@gnu.org; Wed, 12 Mar 2014 19:25:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WNsWE-0000lM-Ib for bug-gnu-emacs@gnu.org; Wed, 12 Mar 2014 19:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 12 Mar 2014 23:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16818 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16818-submit@debbugs.gnu.org id=B16818.13946666892904 (code B ref 16818); Wed, 12 Mar 2014 23:25:02 +0000 Original-Received: (at 16818) by debbugs.gnu.org; 12 Mar 2014 23:24:49 +0000 Original-Received: from localhost ([127.0.0.1]:35046 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WNsW0-0000kl-Js for submit@debbugs.gnu.org; Wed, 12 Mar 2014 19:24:48 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:53779) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WNsVy-0000kd-Qs for 16818@debbugs.gnu.org; Wed, 12 Mar 2014 19:24:47 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFMCppy/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2NDYN9A6R6gV6DE4FK X-IPAS-Result: Av4EABK/CFFMCppy/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2NDYN9A6R6gV6DE4FK X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="51544378" Original-Received: from 76-10-154-114.dsl.teksavvy.com (HELO ceviche.home) ([76.10.154.114]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 12 Mar 2014 19:24:46 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id BF26B66090; Wed, 12 Mar 2014 19:24:45 -0400 (EDT) In-Reply-To: (Barry OReilly's message of "Tue, 11 Mar 2014 17:24:25 -0400") 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:86800 Archived-At: > At the end is a patch to implement this. I wrote the marker-tests to > make sure I didn't break anything too badly, they pass with or without > the rest of the patch. The new undo-test-mark-adjustment implements > the recipe of this bug report. It fails with current trunk and passes > with the patch. Thinking more about this, I think this is fixing the symptom, but not the cause. The cause is that primitive-undo shouldn't blindly obey a (MARKER . OFFSET) entry. Instead it should only obey it if the marker still points at the corresponding place. Your patch works around the problem by trying to avoid moving the mark (creating new markers each time instead) but that doesn't fix the problem for the other markers. Problem is: the undo log format as it stands does not record in a reliable way what was the marker's position at that time, so it's not easy to figure out whether the marker is still at the "same place" or not. This said, in practice, those (MARKER . OFFSET) entries are only introduced for text deletion. So we should normally find them immediately after a (STRING . POS) and those (MARKER . OFFSET) should only be applied if that MARKER was at POS before undoing the deletion of STRING. IOW, I think the right fix is to change primitive-undo's handling of (STRING . POS) by first looking at subsequent (MARKER . OFFSET) entries and dropping those whose MARKER is not currently at POS. WDYT? Stefan