diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-02-04 15:29:44 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-02-04 15:29:44 +0000 |
commit | d9090cc15a6ec3039fc0dc9ef4c826b8541d78f1 (patch) | |
tree | 83667ffb61760f1c834ceb316b7508300bcea86a /lisp/subr.el | |
parent | ca1617bfd6e10ca2ff245006d967d954d1d5c0a2 (diff) | |
download | emacs-d9090cc15a6ec3039fc0dc9ef4c826b8541d78f1.tar.gz |
(cancel-change-group): Don't move point.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index b4bd4a0150c..ef908c0a7cb 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1871,28 +1871,29 @@ This finishes the change group by accepting its changes as final." (defun cancel-change-group (handle) "Finish a change group made with `prepare-change-group' (which see). This finishes the change group by reverting all of its changes." - (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. - (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))))) + (save-excursion + (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. + (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)))))) ;;;; Display-related functions. |