Mercurial > emacs
comparison lisp/emulation/viper-util.el @ 33019:6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
* viper-cmd.el (viper-preserve-cursor-color): new test that avoids
rewrawing the screen when changing cursor color.
(viper-insert-state-pre-command-sentinel,
viper-replace-state-pre-command-sentinel,
viper-replace-state-post-command-sentinel): use
viper-preserve-cursor-color.
Many functions changed to use viper= instead of = when comparing
characters.
* viper-util.el (viper-memq-char,viper=): new functions for
working with characters.
(viper-change-cursor-color): fixed buglet.
Many functions changed to use viper= instead of = when comparing
characters.
* viper.el (viper-insert-state-mode-list): added eshell.
* ediff-init.el (ediff-before-setup-hook): new hook.
Several typos fixed in various docstrings.
* ediff-merg.el (ediff-show-clashes-only): docstring typo fixed.
* ediff-nult.el (ediff-before-session-group-setup-hooks): new
hook.
(ediff-show-meta-buffer): run ediff-before-session-group-setup-hooks.
* ediff-util.el (ediff-setup): run ediff-before-setup-hook.
(ediff-other-buffer): use selected buffers if in Buffer-menu buffer.
(ediff-get-selected-buffers): new function.
* ediff-vers.el (ediff-vc-internal,ediff-rcs-internal,
ediff-vc-merge-internal,ediff-rcs-merge-internal): use
save-window-excursion.
* ediff-wind.el (ediff-skip-unsuitable-frames): more robust
termination check in while loop.
* ediff.el (ediff-get-default-file-name): better defaults when in
dired buffer.
(ediff-files,ediff-merge-files,ediff-files3,
ediff-merge-files-with-ancestor): use ediff-get-default-file-name.
author | Michael Kifer <kifer@cs.stonybrook.edu> |
---|---|
date | Sun, 29 Oct 2000 04:56:45 +0000 |
parents | 6fb7a3864791 |
children | f3a1a5ef5e7f |
comparison
equal
deleted
inserted
replaced
33018:d9abb0441663 | 33019:6306740f6938 |
---|---|
100 | 100 |
101 (fset 'viper-characterp | 101 (fset 'viper-characterp |
102 (symbol-function | 102 (symbol-function |
103 (if viper-xemacs-p 'characterp 'integerp))) | 103 (if viper-xemacs-p 'characterp 'integerp))) |
104 | 104 |
105 ; CHAR is supposed to be a char or an integer; LIST is a list of chars, nil, | |
106 ; and negative numbers | |
107 ; Check if CHAR is a member by trying to convert into integers, if necessary. | |
108 ; Introduced for compatibility with XEmacs, where integers are not the same as | |
109 ; chars. | |
110 (defun viper-memq-char (char list) | |
111 (cond (viper-emacs-p (memq char list)) | |
112 ((null char) (memq char list)) | |
113 ((characterp char) (memq char list)) | |
114 ((integerp char) (memq (int-to-char char) list)) | |
115 (t nil))) | |
116 | |
117 ;; Like =, but accommodates null and also is t for eq-objects | |
118 (defun viper= (char char1) | |
119 (cond ((eq char char1) t) | |
120 ((and (viper-characterp char) (viper-characterp char1)) | |
121 (= char char1)) | |
122 (t nil))) | |
123 | |
105 (defsubst viper-color-display-p () | 124 (defsubst viper-color-display-p () |
106 (if viper-emacs-p | 125 (if viper-emacs-p |
107 (x-display-color-p) | 126 (x-display-color-p) |
108 (eq (device-class (selected-device)) 'color))) | 127 (eq (device-class (selected-device)) 'color))) |
109 | 128 |
122 ;; cursor colors | 141 ;; cursor colors |
123 (defun viper-change-cursor-color (new-color) | 142 (defun viper-change-cursor-color (new-color) |
124 (if (and (viper-window-display-p) (viper-color-display-p) | 143 (if (and (viper-window-display-p) (viper-color-display-p) |
125 (stringp new-color) (viper-color-defined-p new-color) | 144 (stringp new-color) (viper-color-defined-p new-color) |
126 (not (string= new-color (viper-get-cursor-color)))) | 145 (not (string= new-color (viper-get-cursor-color)))) |
127 (modify-frame-parameters | 146 (if viper-emacs-p |
128 (selected-frame) (list (cons 'cursor-color new-color))))) | 147 (modify-frame-parameters |
148 (selected-frame) (list (cons 'cursor-color new-color))) | |
149 (set-frame-property | |
150 (selected-frame) 'cursor-color (make-color-instance new-color))) | |
151 )) | |
129 | 152 |
130 ;; By default, saves current frame cursor color in the | 153 ;; By default, saves current frame cursor color in the |
131 ;; viper-saved-cursor-color-in-replace-mode property of viper-replace-overlay | 154 ;; viper-saved-cursor-color-in-replace-mode property of viper-replace-overlay |
132 (defun viper-save-cursor-color (before-which-mode) | 155 (defun viper-save-cursor-color (before-which-mode) |
133 (if (and (viper-window-display-p) (viper-color-display-p)) | 156 (if (and (viper-window-display-p) (viper-color-display-p)) |
699 | 722 |
700 (defun viper-hide-search-overlay () | 723 (defun viper-hide-search-overlay () |
701 (if (not (viper-overlay-p viper-search-overlay)) | 724 (if (not (viper-overlay-p viper-search-overlay)) |
702 (progn | 725 (progn |
703 (setq viper-search-overlay | 726 (setq viper-search-overlay |
704 (viper-make-overlay beg end (current-buffer))) | 727 (viper-make-overlay (point-min) (point-min) (current-buffer))) |
705 (viper-overlay-put | 728 (viper-overlay-put |
706 viper-search-overlay 'priority viper-search-overlay-priority))) | 729 viper-search-overlay 'priority viper-search-overlay-priority))) |
707 (viper-overlay-put viper-search-overlay 'face nil)) | 730 (viper-overlay-put viper-search-overlay 'face nil)) |
708 | 731 |
709 ;; Replace state | 732 ;; Replace state |
952 (setq event ?\C-h)) | 975 (setq event ?\C-h)) |
953 (t (event-basic-type event))) | 976 (t (event-basic-type event))) |
954 ))) | 977 ))) |
955 (if (viper-characterp basis) | 978 (if (viper-characterp basis) |
956 (setq basis | 979 (setq basis |
957 (if (= basis ?\C-?) | 980 (if (viper= basis ?\C-?) |
958 (list 'control '\?) ; taking care of an emacs bug | 981 (list 'control '\?) ; taking care of an emacs bug |
959 (intern (char-to-string basis))))) | 982 (intern (char-to-string basis))))) |
960 (if mod | 983 (if mod |
961 (append mod (list basis)) | 984 (append mod (list basis)) |
962 basis)))) | 985 basis)))) |
1197 (if char | 1220 (if char |
1198 (if (eq viper-syntax-preference 'strict-vi) | 1221 (if (eq viper-syntax-preference 'strict-vi) |
1199 (looking-at (concat "[" viper-strict-ALPHA-chars addl-chars "]")) | 1222 (looking-at (concat "[" viper-strict-ALPHA-chars addl-chars "]")) |
1200 (or | 1223 (or |
1201 ;; or one of the additional chars being asked to include | 1224 ;; or one of the additional chars being asked to include |
1202 (memq char (viper-string-to-list addl-chars)) | 1225 (viper-memq-char char (viper-string-to-list addl-chars)) |
1203 (and | 1226 (and |
1204 ;; not one of the excluded word chars | 1227 ;; not one of the excluded word chars (note: |
1205 (not (memq char viper-non-word-characters)) | 1228 ;; viper-non-word-characters is a list) |
1229 (not (viper-memq-char char viper-non-word-characters)) | |
1206 ;; char of the Viper-word syntax class | 1230 ;; char of the Viper-word syntax class |
1207 (memq (char-syntax char) | 1231 (viper-memq-char (char-syntax char) |
1208 (viper-string-to-list viper-ALPHA-char-class)))))) | 1232 (viper-string-to-list viper-ALPHA-char-class)))))) |
1209 )) | 1233 )) |
1210 | 1234 |
1211 (defun viper-looking-at-separator () | 1235 (defun viper-looking-at-separator () |
1212 (let ((char (char-after (point)))) | 1236 (let ((char (char-after (point)))) |
1213 (if char | 1237 (if char |
1214 (if (eq viper-syntax-preference 'strict-vi) | 1238 (if (eq viper-syntax-preference 'strict-vi) |
1215 (memq char (viper-string-to-list viper-strict-SEP-chars)) | 1239 (viper-memq-char char (viper-string-to-list viper-strict-SEP-chars)) |
1216 (or (eq char ?\n) ; RET is always a separator in Vi | 1240 (or (eq char ?\n) ; RET is always a separator in Vi |
1217 (memq (char-syntax char) | 1241 (viper-memq-char (char-syntax char) |
1218 (viper-string-to-list viper-SEP-char-class))))) | 1242 (viper-string-to-list viper-SEP-char-class))))) |
1219 )) | 1243 )) |
1220 | 1244 |
1221 (defsubst viper-looking-at-alphasep (&optional addl-chars) | 1245 (defsubst viper-looking-at-alphasep (&optional addl-chars) |
1222 (or (viper-looking-at-separator) (viper-looking-at-alpha addl-chars))) | 1246 (or (viper-looking-at-separator) (viper-looking-at-alpha addl-chars))) |
1223 | 1247 |
1338 (memq syntax-of-char-looked-at syntax)) | 1362 (memq syntax-of-char-looked-at syntax)) |
1339 ;; if char-syntax class is "word", make sure it is not one | 1363 ;; if char-syntax class is "word", make sure it is not one |
1340 ;; of the excluded characters | 1364 ;; of the excluded characters |
1341 (if (and (eq syntax-of-char-looked-at ?w) | 1365 (if (and (eq syntax-of-char-looked-at ?w) |
1342 (not negated-syntax)) | 1366 (not negated-syntax)) |
1343 (not (memq char-looked-at viper-non-word-characters)) | 1367 (not (viper-memq-char |
1368 char-looked-at viper-non-word-characters)) | |
1344 t)) | 1369 t)) |
1345 (funcall skip-syntax-func 1) | 1370 (funcall skip-syntax-func 1) |
1346 0) | 1371 0) |
1347 (funcall skip-chars-func addl-chars limit))) | 1372 (funcall skip-chars-func addl-chars limit))) |
1348 (setq total (+ total local))) | 1373 (setq total (+ total local))) |