From 9116e7f00f90fb14857d21698b1e6870fcf98bbd Mon Sep 17 00:00:00 2001 From: Phillip Lord Date: Mon, 30 May 2016 22:50:36 +0100 Subject: [PATCH] Stop mini-buffer causing undo boundaries * lisp/simple.el (undo-auto--boundaries): Check whether minibuffer is current, and if so limit undo-boundaries to it. Addresses #23632 --- lisp/simple.el | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index c5aa292..788cbb2 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2887,12 +2887,21 @@ undo-auto--boundaries "Check recently changed buffers and add a boundary if necessary. REASON describes the reason that the boundary is being added; see `undo-last-boundary' for more information." - (dolist (b undo-auto--undoably-changed-buffers) - (when (buffer-live-p b) - (with-current-buffer b - (unless undo-auto-disable-boundaries - (undo-auto--ensure-boundary cause))))) - (setq undo-auto--undoably-changed-buffers nil)) + ;; We treat the minibuffer specially, because some commands use the + ;; minibuffer after changing the buffer that they are launched + ;; from. Changes in the minibuffer force an undo-boundary in the + ;; launched buffer without this handling. (see bug #23632) + (if (minibufferp) + (progn + (undo-auto--ensure-boundary cause) + (setq undo-auto--undoably-changed-buffers + (delq (current-buffer) undo-auto--undoably-changed-buffers))) + (dolist (b undo-auto--undoably-changed-buffers) + (when (buffer-live-p b) + (with-current-buffer b + (unless undo-auto-disable-boundaries + (undo-auto--ensure-boundary cause))))) + (setq undo-auto--undoably-changed-buffers nil))) (defun undo-auto--boundary-timer () "Timer which will run `undo--auto-boundary-timer'." -- 2.8.3