From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry OReilly Newsgroups: gmane.emacs.bugs Subject: bug#16411: undo-only bugs Date: Tue, 18 Feb 2014 12:40:38 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c2903c3bea2c04f2b1c55c X-Trace: ger.gmane.org 1392746054 14700 80.91.229.3 (18 Feb 2014 17:54:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Feb 2014 17:54:14 +0000 (UTC) To: 16411@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 18 18:54:20 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 1WFos7-0003aW-IK for geb-bug-gnu-emacs@m.gmane.org; Tue, 18 Feb 2014 18:54:19 +0100 Original-Received: from localhost ([::1]:52423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFos7-0004f6-6l for geb-bug-gnu-emacs@m.gmane.org; Tue, 18 Feb 2014 12:54:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WForv-0004bE-Bp for bug-gnu-emacs@gnu.org; Tue, 18 Feb 2014 12:54:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WForp-0004Of-Op for bug-gnu-emacs@gnu.org; Tue, 18 Feb 2014 12:54:07 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57576) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WForp-0004Ny-Ku for bug-gnu-emacs@gnu.org; Tue, 18 Feb 2014 12:54:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WFogE-0006gZ-7G for bug-gnu-emacs@gnu.org; Tue, 18 Feb 2014 12:42:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Barry OReilly Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 18 Feb 2014 17:42:02 +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.139274528025638 (code B ref 16411); Tue, 18 Feb 2014 17:42:02 +0000 Original-Received: (at 16411) by debbugs.gnu.org; 18 Feb 2014 17:41:20 +0000 Original-Received: from localhost ([127.0.0.1]:58743 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WFofW-0006fR-Pf for submit@debbugs.gnu.org; Tue, 18 Feb 2014 12:41:19 -0500 Original-Received: from mail-oa0-f42.google.com ([209.85.219.42]:39267) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WFofT-0006fA-Cg for 16411@debbugs.gnu.org; Tue, 18 Feb 2014 12:41:16 -0500 Original-Received: by mail-oa0-f42.google.com with SMTP id i7so19599752oag.15 for <16411@debbugs.gnu.org>; Tue, 18 Feb 2014 09:41:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=90yGC29SL3/CGmWz8BfvU0AoC24OSvhrNGq5JNI6Zrs=; b=mJZsxwl41uJyZiDkyz7G00L9ePL3iOwdrhuo7q4F4ES9v0X5oTtMhXvHyBnjCd/1Hv fyvpuNusPMjoUpjC+Pmk5rfhLR8BYIgPTGa6Z8U1iChsIjuFZ7INMrp6iP4NOgmwSvQ/ ZkxxV8YJQ8129wNDJ/W2vVA9u3phls9dtTtxtaDOygYM+5ZHecXgv8xxATFI2EE+gaQu NHy2esZjF+sE3IhQSdtyXtDO5MFKfQ4uBcBulRBajXerRKDm0mtFgb9/WuXdwXSno86l +2xMQv5xll232VrhFvjBolXsaFK61dWWGukI556tAoLtzpdUeuyuYALvZ8F09N9fgaoB 3oEw== X-Received: by 10.182.28.134 with SMTP id b6mr27151841obh.27.1392745239012; Tue, 18 Feb 2014 09:40:39 -0800 (PST) Original-Received: by 10.76.21.84 with HTTP; Tue, 18 Feb 2014 09:40:38 -0800 (PST) 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:85837 Archived-At: --001a11c2903c3bea2c04f2b1c55c Content-Type: text/plain; charset=ISO-8859-1 > ;; (BEGIN . END) > (and (>= (car undo-elt) start) > (<= (cdr undo-elt) end)) > ^^ > > ;; (TEXT . POSITION) > (and (>= (abs (cdr undo-elt)) start) > (< (abs (cdr undo-elt)) end)) > ^ Using 'git log -L' on these two code fragments, I found the (BEGIN . END) case changed in this commit to "Fix one-off error at END". commit 9debee7a5e6ebc0c32141619248e7390f1476946 Author: Richard M. Stallman Date: Mon Sep 9 00:27:30 2002 +0000 (undo-elt-in-region): Fix one-off error at END. (forward-visible-line): Handle invisibility by ignoring invisible newlines. Also include entire invisible lines beyond the stopping point. diff --git a/lisp/simple.el b/lisp/simple.el index bfef653..d9ae114 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1089,7 +1089,7 @@ we stop and ignore all further elements." If it crosses the edge, we return nil." (cond ((integerp undo-elt) (and (>= undo-elt start) - (< undo-elt end))) + (<= undo-elt end))) ((eq undo-elt nil) t) ((atom undo-elt) @@ -1109,16 +1109,16 @@ If it crosses the edge, we return nil." (cons alist-elt undo-adjusted-markers))) (and (cdr alist-elt) (>= (cdr alist-elt) start) - (< (cdr alist-elt) end)))) + (<= (cdr alist-elt) end)))) ((null (car undo-elt)) ;; (nil PROPERTY VALUE BEG . END) (let ((tail (nthcdr 3 undo-elt))) (and (>= (car tail) start) - (< (cdr tail) end)))) + (<= (cdr tail) end)))) ((integerp (car undo-elt)) ;; (BEGIN . END) (and (>= (car undo-elt) start) - (< (cdr undo-elt) end))))) + (<= (cdr undo-elt) end))))) (defun undo-elt-crosses-region (undo-elt start end) "Test whether UNDO-ELT crosses one edge of that region START ... END. This didn't change the (TEXT . POSITION) case, which hasn't changed since 1998 when it was first introduced. Maybe it was forgotten in the above 2002 change? Anyway, I made this change locally: diff --git a/lisp/simple.el b/lisp/simple.el index b90382d..01d4f19 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2434,7 +2434,7 @@ If it crosses the edge, we return nil." ((stringp (car undo-elt)) ;; (TEXT . POSITION) (and (>= (abs (cdr undo-elt)) start) - (< (abs (cdr undo-elt)) end))) + (<= (abs (cdr undo-elt)) end))) ((and (consp undo-elt) (markerp (car undo-elt))) ;; This is a marker-adjustment element (MARKER . ADJUSTMENT). ;; See if MARKER is inside the region. and I didn't witness the incorrect behavior from undo in region. Another justification for this change, in addition to fixing the buffer corruption my recipe demonstrates, is that without it, a deletion at the EOB is inaccessible via undo in region. --001a11c2903c3bea2c04f2b1c55c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
>=A0=A0 ;; (BEGIN . END)
>=A0=A0 (and (>=3D (c= ar undo-elt) start)
>=A0=A0=A0=A0=A0=A0=A0 (<=3D (cdr undo-elt) en= d))
>=A0=A0=A0=A0=A0=A0=A0=A0 ^^
>
>=A0=A0 ;; (TEXT . PO= SITION)
>=A0=A0 (and (>=3D (abs (cdr undo-elt)) start)
>=A0=A0=A0=A0=A0=A0=A0 (< (abs (cdr undo-elt)) end))
>=A0=A0=A0= =A0=A0=A0=A0=A0 ^

Using 'git log -L' on these two code fragm= ents, I found the (BEGIN .
END) case changed in this commit to "Fix= one-off error at END".

commit 9debee7a5e6ebc0c32141619248e7390f1476946
Author: Richard M. S= tallman <rms@gnu.org>
Date:=A0= =A0 Mon Sep 9 00:27:30 2002 +0000

=A0=A0=A0 (undo-elt-in-region): Fi= x one-off error at END.
=A0=A0=A0 (forward-visible-line): Handle invisibility by ignoring
=A0=A0= =A0 invisible newlines.=A0 Also include entire invisible lines beyond
= =A0=A0=A0 the stopping point.

diff --git a/lisp/simple.el b/lisp/sim= ple.el
index bfef653..d9ae114 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1089,7 +1089,7 @@ we st= op and ignore all further elements."
=A0If it crosses the edge, we = return nil."
=A0=A0 (cond ((integerp undo-elt)
=A0=A0=A0=A0=A0= =A0=A0=A0 (and (>=3D undo-elt start)
-=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (<=A0 undo-elt end)))
+=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (<=3D undo-elt end)))
=A0=A0=A0=A0=A0= =A0=A0 ((eq undo-elt nil)
=A0=A0=A0=A0=A0=A0=A0=A0 t)
=A0=A0=A0=A0=A0= =A0=A0 ((atom undo-elt)
@@ -1109,16 +1109,16 @@ If it crosses the edge, = we return nil."
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (cons alist-elt undo= -adjusted-markers)))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (and (cdr alist-elt)=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (>=3D (cdr alist-elt) = start)
-=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (< (cdr alist-elt)= end))))
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (<=3D (cdr alist= -elt) end))))
=A0=A0=A0=A0=A0=A0=A0 ((null (car undo-elt))
=A0=A0=A0=A0=A0=A0=A0=A0 ;;= (nil PROPERTY VALUE BEG . END)
=A0=A0=A0=A0=A0=A0=A0=A0 (let ((tail (nt= hcdr 3 undo-elt)))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (and (>=3D (car tai= l) start)
-=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (< (cdr tail) e= nd))))
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (<=3D (cdr tail) e= nd))))
=A0=A0=A0=A0=A0=A0=A0 ((integerp (car undo-elt))
=A0=A0=A0=A0=A0=A0=A0= =A0 ;; (BEGIN . END)
=A0=A0=A0=A0=A0=A0=A0=A0 (and (>=3D (car undo-el= t) start)
-=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (< (cdr undo-elt) end= )))))
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (<=3D (cdr undo-elt) end)= ))))
=A0
=A0(defun undo-elt-crosses-region (undo-elt start end)
=A0=A0 "Test whether UNDO-ELT crosses one edge of that region START ..= . END.

This didn't change the (TEXT . POSITION) case, which hasn= 't changed
since 1998 when it was first introduced. Maybe it was for= gotten in the
above 2002 change?

Anyway, I made this change locally:

diff -= -git a/lisp/simple.el b/lisp/simple.el
index b90382d..01d4f19 100644
= --- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2434,7 +2434,7 @@ If it= crosses the edge, we return nil."
=A0=A0=A0=A0=A0=A0=A0 ((stringp (car undo-elt))
=A0=A0=A0=A0=A0=A0=A0=A0= ;; (TEXT . POSITION)
=A0=A0=A0=A0=A0=A0=A0=A0 (and (>=3D (abs (cdr u= ndo-elt)) start)
-=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (< (abs (cdr u= ndo-elt)) end)))
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (<=3D (abs (cd= r undo-elt)) end)))
=A0=A0=A0=A0=A0=A0=A0 ((and (consp undo-elt) (markerp (car undo-elt)))
= =A0=A0=A0=A0=A0=A0=A0=A0 ;; This is a marker-adjustment element (MARKER . A= DJUSTMENT).
=A0=A0=A0=A0=A0=A0=A0=A0 ;; See if MARKER is inside the regi= on.

and I didn't witness the incorrect behavior from undo in reg= ion.

Another justification for this change, in addition to fixing the
buf= fer corruption my recipe demonstrates, is that without it, a
deletion at= the EOB is inaccessible via undo in region.

--001a11c2903c3bea2c04f2b1c55c--