Mercurial > emacs
comparison lisp/emulation/viper-util.el @ 90596:6823a91487f2
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 399-413)
- Update from CVS
- Rcirc update from Ryan Yeske
- Merge from gnus--rel--5.10
- Miscellaneous tq-related fixes.
* gnus--rel--5.10 (patch 126-127)
- Merge from emacs--devo--0
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-105
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 28 Aug 2006 04:33:45 +0000 |
parents | 4094c5298ae1 aba79a1f03ed |
children | 95d0cdf160ea |
comparison
equal
deleted
inserted
replaced
90595:fd59c4164a14 | 90596:6823a91487f2 |
---|---|
135 (viper-cond-compile-for-xemacs-or-emacs | 135 (viper-cond-compile-for-xemacs-or-emacs |
136 (eq (device-class (selected-device)) 'color) ; xemacs | 136 (eq (device-class (selected-device)) 'color) ; xemacs |
137 (x-display-color-p) ; emacs | 137 (x-display-color-p) ; emacs |
138 )) | 138 )) |
139 | 139 |
140 (defsubst viper-get-cursor-color () | 140 (defun viper-get-cursor-color (&optional frame) |
141 (viper-cond-compile-for-xemacs-or-emacs | 141 (viper-cond-compile-for-xemacs-or-emacs |
142 (color-instance-name | 142 (color-instance-name |
143 (frame-property (selected-frame) 'cursor-color)) ; xemacs | 143 (frame-property (or frame (selected-frame)) 'cursor-color)) ; xemacs |
144 (cdr (assoc 'cursor-color (frame-parameters))) ; emacs | 144 (cdr (assoc 'cursor-color (frame-parameters))) ; emacs |
145 )) | 145 )) |
146 | 146 |
147 | 147 |
148 ;; OS/2 | 148 ;; OS/2 |
150 (fset 'viper-color-defined-p | 150 (fset 'viper-color-defined-p |
151 (lambda (color) (assoc color pm-color-alist))))) | 151 (lambda (color) (assoc color pm-color-alist))))) |
152 | 152 |
153 | 153 |
154 ;; cursor colors | 154 ;; cursor colors |
155 (defun viper-change-cursor-color (new-color) | 155 (defun viper-change-cursor-color (new-color &optional frame) |
156 (if (and (viper-window-display-p) (viper-color-display-p) | 156 (if (and (viper-window-display-p) (viper-color-display-p) |
157 (stringp new-color) (viper-color-defined-p new-color) | 157 (stringp new-color) (viper-color-defined-p new-color) |
158 (not (string= new-color (viper-get-cursor-color)))) | 158 (not (string= new-color (viper-get-cursor-color)))) |
159 (viper-cond-compile-for-xemacs-or-emacs | 159 (viper-cond-compile-for-xemacs-or-emacs |
160 (set-frame-property | 160 (set-frame-property |
161 (selected-frame) 'cursor-color (make-color-instance new-color)) | 161 (or frame (selected-frame)) |
162 'cursor-color (make-color-instance new-color)) | |
162 (modify-frame-parameters | 163 (modify-frame-parameters |
163 (selected-frame) (list (cons 'cursor-color new-color))) | 164 (or frame (selected-frame)) |
165 (list (cons 'cursor-color new-color))) | |
164 ) | 166 ) |
165 )) | 167 )) |
168 | |
169 (defun viper-set-cursor-color-according-to-state (&optional frame) | |
170 (cond ((eq viper-current-state 'replace-state) | |
171 (viper-change-cursor-color viper-replace-state-cursor-color frame)) | |
172 ((and (eq viper-current-state 'emacs-state) | |
173 viper-emacs-state-cursor-color) | |
174 (viper-change-cursor-color viper-emacs-state-cursor-color frame)) | |
175 ((eq viper-current-state 'insert-state) | |
176 (viper-change-cursor-color viper-insert-state-cursor-color frame)) | |
177 (t | |
178 (viper-change-cursor-color viper-vi-state-cursor-color frame)))) | |
166 | 179 |
167 ;; By default, saves current frame cursor color in the | 180 ;; By default, saves current frame cursor color in the |
168 ;; viper-saved-cursor-color-in-replace-mode property of viper-replace-overlay | 181 ;; viper-saved-cursor-color-in-replace-mode property of viper-replace-overlay |
169 (defun viper-save-cursor-color (before-which-mode) | 182 (defun viper-save-cursor-color (before-which-mode) |
170 (if (and (viper-window-display-p) (viper-color-display-p)) | 183 (if (and (viper-window-display-p) (viper-color-display-p)) |
189 (or | 202 (or |
190 (funcall | 203 (funcall |
191 (if viper-emacs-p 'frame-parameter 'frame-property) | 204 (if viper-emacs-p 'frame-parameter 'frame-property) |
192 (selected-frame) | 205 (selected-frame) |
193 'viper-saved-cursor-color-in-replace-mode) | 206 'viper-saved-cursor-color-in-replace-mode) |
194 (if (eq viper-current-state 'emacs-mode) | 207 (if (and (eq viper-current-state 'emacs-mode) viper-emacs-state-cursor-color) |
195 viper-emacs-state-cursor-color | 208 viper-emacs-state-cursor-color |
196 viper-vi-state-cursor-color))) | 209 viper-vi-state-cursor-color))) |
197 | 210 |
198 (defsubst viper-get-saved-cursor-color-in-insert-mode () | 211 (defsubst viper-get-saved-cursor-color-in-insert-mode () |
199 (or | 212 (or |
200 (funcall | 213 (funcall |
201 (if viper-emacs-p 'frame-parameter 'frame-property) | 214 (if viper-emacs-p 'frame-parameter 'frame-property) |
202 (selected-frame) | 215 (selected-frame) |
203 'viper-saved-cursor-color-in-insert-mode) | 216 'viper-saved-cursor-color-in-insert-mode) |
204 (if (eq viper-current-state 'emacs-mode) | 217 (if (and (eq viper-current-state 'emacs-mode) viper-emacs-state-cursor-color) |
205 viper-emacs-state-cursor-color | 218 viper-emacs-state-cursor-color |
206 viper-vi-state-cursor-color))) | 219 viper-vi-state-cursor-color))) |
207 | 220 |
208 (defsubst viper-get-saved-cursor-color-in-emacs-mode () | 221 (defsubst viper-get-saved-cursor-color-in-emacs-mode () |
209 (or | 222 (or |