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-util.el,v


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

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

Index: emulation/viper-util.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emulation/viper-util.el,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- emulation/viper-util.el     18 Jun 2006 17:08:24 -0000      1.62
+++ emulation/viper-util.el     25 Aug 2006 16:06:57 -0000      1.63
@@ -137,10 +137,10 @@
    (x-display-color-p)  ; emacs
    ))
 
-(defsubst viper-get-cursor-color ()
+(defun viper-get-cursor-color (&optional frame)
   (viper-cond-compile-for-xemacs-or-emacs
    (color-instance-name
-    (frame-property (selected-frame) 'cursor-color)) ; xemacs
+    (frame-property (or frame (selected-frame)) 'cursor-color)) ; xemacs
    (cdr (assoc 'cursor-color (frame-parameters))) ; emacs
    ))
 
@@ -152,18 +152,31 @@
 
 
 ;; cursor colors
-(defun viper-change-cursor-color (new-color)
+(defun viper-change-cursor-color (new-color &optional frame)
   (if (and (viper-window-display-p)  (viper-color-display-p)
           (stringp new-color) (viper-color-defined-p new-color)
           (not (string= new-color (viper-get-cursor-color))))
       (viper-cond-compile-for-xemacs-or-emacs
        (set-frame-property
-       (selected-frame) 'cursor-color (make-color-instance new-color))
+       (or frame (selected-frame))
+       'cursor-color (make-color-instance new-color))
        (modify-frame-parameters
-       (selected-frame) (list (cons 'cursor-color new-color)))
+       (or frame (selected-frame))
+       (list (cons 'cursor-color new-color)))
        )
     ))
 
+(defun viper-set-cursor-color-according-to-state (&optional frame)
+  (cond ((eq viper-current-state 'replace-state)
+        (viper-change-cursor-color viper-replace-state-cursor-color frame))
+       ((and (eq viper-current-state 'emacs-state)
+             viper-emacs-state-cursor-color)
+        (viper-change-cursor-color viper-emacs-state-cursor-color frame))
+       ((eq viper-current-state 'insert-state)
+        (viper-change-cursor-color viper-insert-state-cursor-color frame))
+       (t
+        (viper-change-cursor-color viper-vi-state-cursor-color frame))))
+
 ;; By default, saves current frame cursor color in the
 ;; viper-saved-cursor-color-in-replace-mode property of viper-replace-overlay
 (defun viper-save-cursor-color (before-which-mode)
@@ -191,7 +204,7 @@
     (if viper-emacs-p 'frame-parameter 'frame-property)
     (selected-frame)
     'viper-saved-cursor-color-in-replace-mode)
-   (if (eq viper-current-state 'emacs-mode)
+   (if (and (eq viper-current-state 'emacs-mode) 
viper-emacs-state-cursor-color)
        viper-emacs-state-cursor-color
      viper-vi-state-cursor-color)))
 
@@ -201,7 +214,7 @@
     (if viper-emacs-p 'frame-parameter 'frame-property)
     (selected-frame)
     'viper-saved-cursor-color-in-insert-mode)
-   (if (eq viper-current-state 'emacs-mode)
+   (if (and (eq viper-current-state 'emacs-mode) 
viper-emacs-state-cursor-color)
        viper-emacs-state-cursor-color
      viper-vi-state-cursor-color)))
 




reply via email to

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