From: martin rudalics <rudalics@gmx.at>
To: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>,
810@emacsbugs.donarmstrong.com
Subject: bug#810: 23.0.60; atomic-change-group narrowing problem
Date: Mon, 01 Sep 2008 19:56:54 +0200 [thread overview]
Message-ID: <48BC2CE6.2070108@gmx.at> (raw)
In-Reply-To: <48B6F562.9060006@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 296 bytes --]
> 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
[-- Attachment #2: 810.diff --]
[-- Type: text/plain, Size: 3329 bytes --]
*** 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 ----
\f
;;; Atomic change groups.
+ (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.")
+
(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 state.
! (setq buffer-undo-list elt)))))
\f
;;;; Display-related functions.
--- 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 (= (point-min) atomic-change-point-min)
! (= (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)))))
\f
;;;; Display-related functions.
next prev parent reply other threads:[~2008-09-01 17:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <48C3A6BE.8030305@gmx.at>
2008-08-28 18:58 ` bug#810: 23.0.60; atomic-change-group narrowing problem Lennart Borgman (gmail)
2008-08-28 21:26 ` martin rudalics
2008-08-28 21:37 ` Lennart Borgman (gmail)
2008-08-29 9:27 ` martin rudalics
2008-09-01 17:56 ` martin rudalics [this message]
2008-09-01 20:43 ` Stefan Monnier
2008-09-01 21:20 ` martin rudalics
2008-09-01 21:53 ` Lennart Borgman (gmail)
2008-09-02 2:38 ` Stefan Monnier
2008-09-07 9:37 ` martin rudalics
2008-09-02 14:13 ` Richard M. Stallman
2008-09-07 10:15 ` bug#810: marked as done (23.0.60; atomic-change-group narrowing problem) Emacs bug Tracking System
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48BC2CE6.2070108@gmx.at \
--to=rudalics@gmx.at \
--cc=810@emacsbugs.donarmstrong.com \
--cc=lennart.borgman@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.