aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2008-09-07 09:16:56 +0000
committerMartin Rudalics2008-09-07 09:16:56 +0000
commitd21cba62f0b647ad7ec7ac298f0dae59e06bc381 (patch)
tree269e9b1ead7dba7a0ee26426d608cc1b2321faa2
parent126f1fc1a37a64bce9f5be9bead3b49cec8825b3 (diff)
downloademacs-d21cba62f0b647ad7ec7ac298f0dae59e06bc381.tar.gz
emacs-d21cba62f0b647ad7ec7ac298f0dae59e06bc381.zip
(cancel-change-group): Widen buffer temporarily when
undoing changes. (Bug#810)
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/subr.el44
2 files changed, 29 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1bb4e7721cf..46404ef3c09 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12008-09-07 Martin Rudalics <rudalics@gmx.at>
2
3 * subr.el (cancel-change-group): Widen buffer temporarily when
4 undoing changes. (Bug#810)
5
12008-09-07 Nick Roberts <nickrob@snap.net.nz> 62008-09-07 Nick Roberts <nickrob@snap.net.nz>
2 7
3 * progmodes/gud.el (gud-stop-subjob): Using jdb, suspend threads 8 * progmodes/gud.el (gud-stop-subjob): Using jdb, suspend threads
diff --git a/lisp/subr.el b/lisp/subr.el
index b7b6b2c38de..2aa802cd03e 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1993,26 +1993,30 @@ This finishes the change group by reverting all of its changes."
1993 (dolist (elt handle) 1993 (dolist (elt handle)
1994 (with-current-buffer (car elt) 1994 (with-current-buffer (car elt)
1995 (setq elt (cdr elt)) 1995 (setq elt (cdr elt))
1996 (let ((old-car 1996 (save-restriction
1997 (if (consp elt) (car elt))) 1997 ;; Widen buffer temporarily so if the buffer was narrowed within
1998 (old-cdr 1998 ;; the body of `atomic-change-group' all changes can be undone.
1999 (if (consp elt) (cdr elt)))) 1999 (widen)
2000 ;; Temporarily truncate the undo log at ELT. 2000 (let ((old-car
2001 (when (consp elt) 2001 (if (consp elt) (car elt)))
2002 (setcar elt nil) (setcdr elt nil)) 2002 (old-cdr
2003 (unless (eq last-command 'undo) (undo-start)) 2003 (if (consp elt) (cdr elt))))
2004 ;; Make sure there's no confusion. 2004 ;; Temporarily truncate the undo log at ELT.
2005 (when (and (consp elt) (not (eq elt (last pending-undo-list)))) 2005 (when (consp elt)
2006 (error "Undoing to some unrelated state")) 2006 (setcar elt nil) (setcdr elt nil))
2007 ;; Undo it all. 2007 (unless (eq last-command 'undo) (undo-start))
2008 (save-excursion 2008 ;; Make sure there's no confusion.
2009 (while (listp pending-undo-list) (undo-more 1))) 2009 (when (and (consp elt) (not (eq elt (last pending-undo-list))))
2010 ;; Reset the modified cons cell ELT to its original content. 2010 (error "Undoing to some unrelated state"))
2011 (when (consp elt) 2011 ;; Undo it all.
2012 (setcar elt old-car) 2012 (save-excursion
2013 (setcdr elt old-cdr)) 2013 (while (listp pending-undo-list) (undo-more 1)))
2014 ;; Revert the undo info to what it was when we grabbed the state. 2014 ;; Reset the modified cons cell ELT to its original content.
2015 (setq buffer-undo-list elt))))) 2015 (when (consp elt)
2016 (setcar elt old-car)
2017 (setcdr elt old-cdr))
2018 ;; Revert the undo info to what it was when we grabbed the state.
2019 (setq buffer-undo-list elt))))))
2016 2020
2017;;;; Display-related functions. 2021;;;; Display-related functions.
2018 2022