emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/emulation/viper-cmd.el,v


From: Michael Kifer
Subject: [Emacs-diffs] Changes to emacs/lisp/emulation/viper-cmd.el,v
Date: Fri, 25 Aug 2006 16:07:00 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Michael Kifer <kifer>   06/08/25 16:06:58

Index: emulation/viper-cmd.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emulation/viper-cmd.el,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- emulation/viper-cmd.el      18 Jun 2006 17:08:24 -0000      1.54
+++ emulation/viper-cmd.el      25 Aug 2006 16:06:57 -0000      1.55
@@ -46,6 +46,8 @@
 (defvar mark-even-if-inactive)
 (defvar init-message)
 (defvar initial)
+(defvar undo-beg-posn)
+(defvar undo-end-posn)
 
 ;; loading happens only in non-interactive compilation
 ;; in order to spare non-viperized emacs from being viperized
@@ -196,7 +198,7 @@
            (viper-save-cursor-color 'before-insert-mode))
        ;; set insert mode cursor color
        (viper-change-cursor-color viper-insert-state-cursor-color)))
-  (if (eq viper-current-state 'emacs-state)
+  (if (and viper-emacs-state-cursor-color (eq viper-current-state 
'emacs-state))
       (let ((has-saved-cursor-color-in-emacs-mode
             (stringp (viper-get-saved-cursor-color-in-emacs-mode))))
        (or has-saved-cursor-color-in-emacs-mode
@@ -722,12 +724,13 @@
       (viper-set-replace-overlay (point-min) (point-min)))
   (viper-hide-replace-overlay)
 
+  (if viper-emacs-state-cursor-color
   (let ((has-saved-cursor-color-in-emacs-mode
         (stringp (viper-get-saved-cursor-color-in-emacs-mode))))
     (or has-saved-cursor-color-in-emacs-mode
        (string= (viper-get-cursor-color) viper-emacs-state-cursor-color)
        (viper-save-cursor-color 'before-emacs-mode))
-    (viper-change-cursor-color viper-emacs-state-cursor-color))
+       (viper-change-cursor-color viper-emacs-state-cursor-color)))
 
   (viper-change-state 'emacs-state)
 
@@ -1030,10 +1033,13 @@
        (inhibit-quit t))
     (if (viper-ESC-event-p event)
        (progn
-         ;; Emacs 22.50.8 introduced a bug, which makes even a single ESC into
-         ;; a fast keyseq. To guard against this, we added a check if there
-         ;; are other events as well
-         (if (and (viper-fast-keysequence-p) unread-command-events)
+         ;; Some versions of Emacs (eg., 22.50.8 have a bug, which makes even
+         ;; a single ESC into ;; a fast keyseq. To guard against this, we
+         ;; added a check if there are other events as well. Keep the next
+         ;; line for the next time the bug reappears, so that will remember to
+         ;; report it.
+         ;;(if (and (viper-fast-keysequence-p) unread-command-events)
+         (if (viper-fast-keysequence-p) ;; for Emacsen without the above bug
              (progn
                (let (minor-mode-map-alist emulation-mode-map-alists)
                  (viper-set-unread-command-events event)
@@ -1744,12 +1750,14 @@
 
 ;; Hook used in viper-undo
 (defun viper-after-change-undo-hook (beg end len)
+  (if undo-in-progress
   (setq undo-beg-posn beg
        undo-end-posn (or end beg))
   ;; some other hooks may be changing various text properties in
   ;; the buffer in response to 'undo'; so remove this hook to avoid
   ;; its repeated invocation
-  (remove-hook 'viper-undo-functions 'viper-after-change-undo-hook 'local))
+    (remove-hook 'viper-undo-functions 'viper-after-change-undo-hook 'local)
+  ))
 
 (defun viper-undo ()
   "Undo previous change."
@@ -1764,9 +1772,13 @@
 
     (undo-start)
     (undo-more 2)
-    (setq undo-beg-posn (or undo-beg-posn before-undo-pt)
-         undo-end-posn (or undo-end-posn undo-beg-posn))
+    ;;(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)
+    ;;      undo-end-posn (or undo-end-posn undo-beg-posn))
 
+    (if (and undo-beg-posn undo-end-posn)
+       (progn
     (goto-char undo-beg-posn)
     (sit-for 0)
     (if (and viper-keep-point-on-undo
@@ -1776,13 +1788,13 @@
          (viper-sit-for-short 300)
          (goto-char undo-end-posn)
          (viper-sit-for-short 300)
-         (if (and (> (viper-chars-in-region undo-beg-posn before-undo-pt) 1)
-                  (> (viper-chars-in-region undo-end-posn before-undo-pt) 1))
+               (if (pos-visible-in-window-p undo-beg-posn)
              (goto-char before-undo-pt)
            (goto-char undo-beg-posn)))
       (push-mark before-undo-pt t))
+         ))
+
     (if (and (eolp) (not (bolp))) (backward-char 1))
-    ;;(if (not modified) (set-buffer-modified-p t))
     )
   (setq this-command 'viper-undo))
 
@@ -3952,7 +3964,8 @@
   (let ((val (viper-p-val arg))
        (com (viper-getcom arg))
        debug-on-error)
-    (if (null viper-s-string) (error viper-NoPrevSearch))
+    (if (or (null viper-s-string) (string= viper-s-string ""))
+       (error viper-NoPrevSearch))
     (viper-search viper-s-string viper-s-forward arg)
     (if com
        (progn




reply via email to

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