emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] fix/viper-undo 6a4259c: Clean up for viper mode fixes


From: Phillip Lord
Subject: [Emacs-diffs] fix/viper-undo 6a4259c: Clean up for viper mode fixes
Date: Thu, 19 May 2016 20:48:48 +0000 (UTC)

branch: fix/viper-undo
commit 6a4259cf4e6350e95bce4a7a65a61835f9f7b1b0
Author: Phillip Lord <address@hidden>
Commit: Phillip Lord <address@hidden>

    Clean up for viper mode fixes
    
    Document undo-auto-disable-boundaries.
    Rename adjust-undo to viper-complete-complex-command-for-undo to better
    reflection function.
    Rename needs-adjustment to in-complex-command.
    Remove viper-buffer-undo-list-mark as it is no longer needed.
---
 lisp/emulation/viper-cmd.el  |   14 +++++++-------
 lisp/emulation/viper-init.el |    9 ++-------
 lisp/simple.el               |   12 +++++++++++-
 3 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index c10943b..f206f76 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -631,7 +631,7 @@
             (viper-over-whitespace-line))
        (indent-to-left-margin))
     (viper-add-newline-at-eob-if-necessary)
-    (viper-adjust-undo)
+    (viper-complete-complex-command-for-undo)
 
     (if (eq viper-current-state 'emacs-state)
        (viper-restore-cursor-color 'after-emacs-mode)
@@ -1570,7 +1570,7 @@ If the prefix argument ARG is non-nil, it is used instead 
of `val'."
        (if (and (eolp) (not (bolp)))
            (backward-char 1))
      ))
-  (viper-adjust-undo) ; take care of undo
+  (viper-complete-complex-command-for-undo) ; take care of undo
   ;; If the prev cmd was rotating the command ring, this means that `.' has
   ;; just executed a command from that ring.  So, push it on the ring again.
   ;; If we are just executing previous command , then don't push viper-d-com
@@ -1671,7 +1671,7 @@ invokes the command before that, etc."
 
     (undo-start)
     (undo-more 2)
-    (viper-adjust-undo)
+    (viper-complete-complex-command-for-undo)
     ;;(setq undo-beg-posn (or undo-beg-posn (point))
     ;;    undo-end-posn (or undo-end-posn (point)))
     ;;(setq undo-beg-posn (or undo-beg-posn before-undo-pt)
@@ -1711,16 +1711,16 @@ invokes the command before that, etc."
 ;; The following two functions are used to set up undo properly.
 ;; In VI, unlike Emacs, if you open a line, say, and add a bunch of lines,
 ;; they are undone all at once.
-(defun viper-adjust-undo ()
+(defun viper-complete-complex-command-for-undo ()
   (setq undo-auto-disable-boundaries nil)
-  (setq viper-undo-needs-adjustment nil)
+  (setq viper-undo-in-complex-command nil)
   (undo-boundary))
 
 
 (defun viper-set-complex-command-for-undo ()
   (when (not viper-undo-needs-adjustment)
     (setq undo-auto-disable-boundaries t)
-    (setq viper-undo-needs-adjustment t)
+    (setq viper-undo-in-complex-command t)
     (undo-boundary)))
 
 ;;; Viper's destructive Command ring utilities
@@ -2585,7 +2585,7 @@ These keys are ESC, RET, and LineFeed."
                (delete-char 1 t)
                (insert char))
 
-    (viper-adjust-undo)
+    (viper-complete-complex-command-for-undo)
     (backward-char arg)
     ))
 
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index 104245b..c1e7662 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -370,13 +370,8 @@ Use `\\[viper-set-expert-level]' to change this.")
 ;; VI-style Undo
 
 ;; Used to 'undo' complex commands, such as replace and insert commands.
-(viper-deflocalvar viper-undo-needs-adjustment nil)
-(put 'viper-undo-needs-adjustment 'permanent-local t)
-
-;; A mark that Viper puts on buffer-undo-list.  Marks the beginning of a
-;; complex command that must be undone atomically.  If inserted, it is
-;; erased by viper-change-state-to-vi and viper-repeat.
-(defconst viper-buffer-undo-list-mark 'viper)
+(viper-deflocalvar viper-undo-in-complex-command nil)
+(put 'viper-undo-in-complex-command 'permanent-local t)
 
 (defcustom viper-keep-point-on-undo nil
   "Non-nil means not to move point while undoing commands.
diff --git a/lisp/simple.el b/lisp/simple.el
index bf3c4d4..c5aa292 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2839,7 +2839,17 @@ buffers that were changed during the last command.")
 
 If set to non-nil, this will effectively disable the timer.")
 
-(defvar-local undo-auto-disable-boundaries nil)
+(defvar-local undo-auto-disable-boundaries nil
+  "Disable the automatic addition of boundaries.
+
+If set to non-nil, `undo-boundary' will not be called
+automatically in a buffer either at the end of a command, or as a
+result of `undo-auto-current-boundary-timer'.
+
+When this is set to non-nil, it is important to ensure that
+`undo-boundary' is called frequently enough. Failure to do so
+will result in user-visible warnings that the situation is
+probably a bug.")
 
 (defvar undo-auto--this-command-amalgamating nil
   "Non-nil if `this-command' should be amalgamated.



reply via email to

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