From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#810: 23.0.60; atomic-change-group narrowing problem Date: Mon, 01 Sep 2008 19:56:54 +0200 Message-ID: <48BC2CE6.2070108@gmx.at> References: <48B6F562.9060006@gmail.com> Reply-To: martin rudalics , 810@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010804080705040106010805" X-Trace: ger.gmane.org 1220293697 16340 80.91.229.12 (1 Sep 2008 18:28:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 1 Sep 2008 18:28:17 +0000 (UTC) To: "Lennart Borgman (gmail)" , 810@emacsbugs.donarmstrong.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 01 20:29:11 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KaE97-0007tF-GM for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Sep 2008 20:29:01 +0200 Original-Received: from localhost ([127.0.0.1]:33606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KaE88-0000IA-Cm for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Sep 2008 14:28:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KaE7j-00009J-Qy for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2008 14:27:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KaE7h-00007u-OJ for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2008 14:27:35 -0400 Original-Received: from [199.232.76.173] (port=53620 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KaE7h-00007f-De for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2008 14:27:33 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:36963) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KaE7g-0005S1-T3 for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2008 14:27:33 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m81IRUEu025489; Mon, 1 Sep 2008 11:27:30 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m81IA4Ik019268; Mon, 1 Sep 2008 11:10:04 -0700 X-Loop: don@donarmstrong.com Resent-From: martin rudalics Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Mon, 01 Sep 2008 18:10:04 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 810 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 810-submit@emacsbugs.donarmstrong.com id=B810.122029204616308 (code B ref 810); Mon, 01 Sep 2008 18:10:04 +0000 Original-Received: (at 810) by emacsbugs.donarmstrong.com; 1 Sep 2008 18:00:46 +0000 Original-Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id m81I0fFO016296 for <810@emacsbugs.donarmstrong.com>; Mon, 1 Sep 2008 11:00:43 -0700 Original-Received: (qmail invoked by alias); 01 Sep 2008 18:00:33 -0000 Original-Received: from 62-47-47-164.adsl.highway.telekom.at (EHLO [62.47.47.164]) [62.47.47.164] by mail.gmx.net (mp027) with SMTP; 01 Sep 2008 20:00:33 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1/nyGolVD3nHKGHZqaf4ikjExsEpcqhtl84Rlf45W JmRxaxkTCOfzF5 User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) In-Reply-To: <48B6F562.9060006@gmail.com> X-Y-GMX-Trusted: 0 X-FuHaFi: 0.87,0.55 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Resent-Date: Mon, 01 Sep 2008 14:27:34 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:19975 Archived-At: This is a multi-part message in MIME format. --------------010804080705040106010805 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit > When using atomic-change-group I got the message > > undo-more: Changes to be undone are outside visible portion of buffer > > The changes are also not undone. This seems wrong to me. The attached patch now also tries to restore any narrowing in force before the atomic change. martin --------------010804080705040106010805 Content-Type: text/plain; name="810.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="810.diff" *** subr.el.~1.604.~ 2008-08-31 09:48:50.531250000 +0200 --- subr.el 2008-09-01 19:52:32.843750000 +0200 *************** *** 1907,1912 **** --- 1907,1917 ---- =0C ;;; Atomic change groups. =20 + (defvar atomic-change-point-min nil + "Value returned by `point-min' before an atomic change.") + (defvar atomic-change-point-max nil + "Value returned by `point-max' before an atomic change.") +=20 (defmacro atomic-change-group (&rest body) "Perform BODY as an atomic change group. This means that if BODY exits abnormally, *************** *** 1920,1925 **** --- 1925,1932 ---- (let ((handle (make-symbol "--change-group-handle--")) (success (make-symbol "--change-group-success--"))) `(let ((,handle (prepare-change-group)) + (atomic-change-point-min (point-min)) + (atomic-change-point-max (point-max)) ;; Don't truncate any undo data in the middle of this. (undo-outer-limit nil) (undo-limit most-positive-fixnum) *************** *** 1992,2017 **** (dolist (elt handle) (with-current-buffer (car elt) (setq elt (cdr elt)) ! (let ((old-car ! (if (consp elt) (car elt))) ! (old-cdr ! (if (consp elt) (cdr elt)))) ! ;; Temporarily truncate the undo log at ELT. ! (when (consp elt) ! (setcar elt nil) (setcdr elt nil)) ! (unless (eq last-command 'undo) (undo-start)) ! ;; Make sure there's no confusion. ! (when (and (consp elt) (not (eq elt (last pending-undo-list))))= ! (error "Undoing to some unrelated state")) ! ;; Undo it all. ! (save-excursion ! (while (listp pending-undo-list) (undo-more 1))) ! ;; Reset the modified cons cell ELT to its original content. ! (when (consp elt) ! (setcar elt old-car) ! (setcdr elt old-cdr)) ! ;; Revert the undo info to what it was when we grabbed the stat= e. ! (setq buffer-undo-list elt))))) =0C ;;;; Display-related functions. =20 --- 1999,2030 ---- (dolist (elt handle) (with-current-buffer (car elt) (setq elt (cdr elt)) ! (save-restriction ! (widen) ! (let ((old-car ! (if (consp elt) (car elt))) ! (old-cdr ! (if (consp elt) (cdr elt)))) ! ;; Temporarily truncate the undo log at ELT. ! (when (consp elt) ! (setcar elt nil) (setcdr elt nil)) ! (unless (eq last-command 'undo) (undo-start)) ! ;; Make sure there's no confusion. ! (when (and (consp elt) (not (eq elt (last pending-undo-list)))) ! (error "Undoing to some unrelated state")) ! ;; Undo it all. ! (save-excursion ! (while (listp pending-undo-list) (undo-more 1))) ! ;; Reset the modified cons cell ELT to its original content. ! (when (consp elt) ! (setcar elt old-car) ! (setcdr elt old-cdr)) ! ;; Revert the undo info to what it was when we grabbed the state. ! (setq buffer-undo-list elt))) ! (unless (and (=3D (point-min) atomic-change-point-min) ! (=3D (point-max) atomic-change-point-max)) ! ;; Try to restore narrowing in force before atomic change. ! (narrow-to-region atomic-change-point-min atomic-change-point-max)))))= =0C ;;;; Display-related functions. =20 --------------010804080705040106010805--