emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 12e009e 2/2: Restore initial undo boundary with v


From: Phillip Lord
Subject: [Emacs-diffs] emacs-25 12e009e 2/2: Restore initial undo boundary with viper
Date: Sat, 11 Jun 2016 19:33:20 +0000 (UTC)

branch: emacs-25
commit 12e009e52f09c27e5b29cf8394eff5e8efdba9b6
Author: Phillip Lord <address@hidden>
Commit: Phillip Lord <address@hidden>

    Restore initial undo boundary with viper
    
    * lisp/emulation/viper-cmd.el (viper-adjust-undo): Add back last undo
      boundary if it has been removed.
    
    Addresses Bug#22295.
---
 lisp/emulation/viper-cmd.el |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index 93cf3b0..4bd819a 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -1715,8 +1715,9 @@ invokes the command before that, etc."
       (let ((inhibit-quit t)
            tmp tmp2)
        (setq viper-undo-needs-adjustment nil)
-       (if (listp buffer-undo-list)
-           (if (setq tmp (memq viper-buffer-undo-list-mark buffer-undo-list))
+       (when (listp buffer-undo-list)
+          (let ((had-boundary (null (car buffer-undo-list))))
+            (if (setq tmp (memq viper-buffer-undo-list-mark buffer-undo-list))
                (progn
                  (setq tmp2 (cdr tmp)) ; the part after mark
 
@@ -1729,8 +1730,11 @@ invokes the command before that, etc."
                        (delq viper-buffer-undo-list-mark buffer-undo-list))
                  ;; restore tail of buffer-undo-list
                  (setq buffer-undo-list (nconc buffer-undo-list tmp2)))
-             (setq buffer-undo-list (delq nil buffer-undo-list)))))
-    ))
+             (setq buffer-undo-list (delq nil buffer-undo-list)))
+            ;; The top-level loop only adds boundaries if there has been
+            ;; modifications in the buffer, so make sure we don't accidentally
+            ;; drop the "final" boundary (bug#22295).
+           (if had-boundary (undo-boundary)))))))
 
 
 (defun viper-set-complex-command-for-undo ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]