diff options
| author | Karl Heuer | 1995-06-09 00:11:53 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-06-09 00:11:53 +0000 |
| commit | 75551c46fbeae986ee4cf3746d6e9e804cd339ae (patch) | |
| tree | 390405cbb7f59c791f70b054703bec00e4f58d49 | |
| parent | 8f2685cb0550e587d4e0ae6a16b1433a11ac9ff7 (diff) | |
| download | emacs-75551c46fbeae986ee4cf3746d6e9e804cd339ae.tar.gz emacs-75551c46fbeae986ee4cf3746d6e9e804cd339ae.zip | |
(vip-event-key): now handles keys 128--255 as meta-chars.
Changed vip-*-frame-* to *-frame-*, incorporated overlay strings,
unread-command-events, removed support for emacs versions 19.28 and
xemacs 19.11 and earlier.
| -rw-r--r-- | lisp/emulation/viper-util.el | 208 |
1 files changed, 117 insertions, 91 deletions
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index 542b0523494..3a0962d47b2 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | ;;; viper-util.el --- Utilities used by viper.el | 1 | ;;; viper-util.el --- Utilities used by viper.el |
| 2 | 2 | ;; Copyright (C) 1994, 1995 Free Software Foundation, Inc. | |
| 3 | ;; Copyright (C) 1995 Free Software Foundation, Inc. | ||
| 4 | 3 | ||
| 5 | ;; This file is part of GNU Emacs. | 4 | ;; This file is part of GNU Emacs. |
| 6 | 5 | ||
| @@ -20,10 +19,18 @@ | |||
| 20 | 19 | ||
| 21 | (require 'ring) | 20 | (require 'ring) |
| 22 | 21 | ||
| 23 | (defconst vip-xemacs-p (string-match "\\(Lucid\\|Xemacs\\)" emacs-version) | 22 | ;; Whether it is XEmacs or not |
| 24 | "Whether it is XEmacs or not.") | 23 | (defconst vip-xemacs-p (string-match "\\(Lucid\\|Xemacs\\)" emacs-version)) |
| 25 | (defconst vip-emacs-p (not vip-xemacs-p) | 24 | ;; Whether it is Emacs or not |
| 26 | "Whether it is Emacs or not.") | 25 | (defconst vip-emacs-p (not vip-xemacs-p)) |
| 26 | ;; Tell whether we are running as a window application or on a TTY | ||
| 27 | (defsubst vip-device-type () | ||
| 28 | (if vip-emacs-p | ||
| 29 | window-system | ||
| 30 | (device-type (selected-device)))) | ||
| 31 | ;; in XEmacs: device-type is tty on tty and stream in batch. | ||
| 32 | (defsubst vip-window-display-p () | ||
| 33 | (and (vip-device-type) (not (memq (vip-device-type) '(tty stream))))) | ||
| 27 | 34 | ||
| 28 | 35 | ||
| 29 | ;;; Macros | 36 | ;;; Macros |
| @@ -92,8 +99,9 @@ | |||
| 92 | (and (<= ?A reg) (<= reg ?Z))) | 99 | (and (<= ?A reg) (<= reg ?Z))) |
| 93 | )) | 100 | )) |
| 94 | 101 | ||
| 102 | ;; checks if object is a marker, has a buffer, and points to within that buffer | ||
| 95 | (defun vip-valid-marker (marker) | 103 | (defun vip-valid-marker (marker) |
| 96 | (if (markerp marker) | 104 | (if (and (markerp marker) (marker-buffer marker)) |
| 97 | (let ((buf (marker-buffer marker)) | 105 | (let ((buf (marker-buffer marker)) |
| 98 | (pos (marker-position marker))) | 106 | (pos (marker-position marker))) |
| 99 | (save-excursion | 107 | (save-excursion |
| @@ -118,23 +126,13 @@ | |||
| 118 | (fset 'vip-overlay-p (symbol-function 'extentp)) | 126 | (fset 'vip-overlay-p (symbol-function 'extentp)) |
| 119 | (fset 'vip-overlay-get (symbol-function 'extent-property)) | 127 | (fset 'vip-overlay-get (symbol-function 'extent-property)) |
| 120 | (fset 'vip-move-overlay (symbol-function 'set-extent-endpoints)) | 128 | (fset 'vip-move-overlay (symbol-function 'set-extent-endpoints)) |
| 121 | (if window-system | 129 | (if (vip-window-display-p) |
| 122 | (fset 'vip-iconify (symbol-function 'iconify-screen))) | 130 | (fset 'vip-iconify (symbol-function 'iconify-frame))) |
| 123 | (fset 'vip-raise-frame (symbol-function 'raise-screen)) | 131 | (cond ((vip-window-display-p) |
| 124 | (fset 'vip-window-frame (symbol-function 'window-screen)) | ||
| 125 | (fset 'vip-select-frame (symbol-function 'select-screen)) | ||
| 126 | (fset 'vip-selected-frame (symbol-function 'selected-screen)) | ||
| 127 | (fset 'vip-frame-selected-window | ||
| 128 | (symbol-function 'screen-selected-window)) | ||
| 129 | (fset 'vip-frame-parameters (symbol-function 'screen-parameters)) | ||
| 130 | (fset 'vip-modify-frame-parameters | ||
| 131 | (symbol-function 'modify-screen-parameters)) | ||
| 132 | (cond (window-system | ||
| 133 | (fset 'vip-get-face (symbol-function 'get-face)) | 132 | (fset 'vip-get-face (symbol-function 'get-face)) |
| 134 | (fset 'vip-color-defined-p | 133 | (fset 'vip-color-defined-p |
| 135 | (symbol-function 'x-valid-color-name-p)) | 134 | (symbol-function 'valid-color-name-p)) |
| 136 | (fset 'vip-display-color-p | 135 | ))) |
| 137 | (symbol-function 'x-color-display-p))))) | ||
| 138 | (fset 'vip-read-event (symbol-function 'read-event)) | 136 | (fset 'vip-read-event (symbol-function 'read-event)) |
| 139 | (fset 'vip-make-overlay (symbol-function 'make-overlay)) | 137 | (fset 'vip-make-overlay (symbol-function 'make-overlay)) |
| 140 | (fset 'vip-overlay-start (symbol-function 'overlay-start)) | 138 | (fset 'vip-overlay-start (symbol-function 'overlay-start)) |
| @@ -143,23 +141,20 @@ | |||
| 143 | (fset 'vip-overlay-p (symbol-function 'overlayp)) | 141 | (fset 'vip-overlay-p (symbol-function 'overlayp)) |
| 144 | (fset 'vip-overlay-get (symbol-function 'overlay-get)) | 142 | (fset 'vip-overlay-get (symbol-function 'overlay-get)) |
| 145 | (fset 'vip-move-overlay (symbol-function 'move-overlay)) | 143 | (fset 'vip-move-overlay (symbol-function 'move-overlay)) |
| 146 | (if window-system | 144 | (if (vip-window-display-p) |
| 147 | (fset 'vip-iconify (symbol-function 'iconify-or-deiconify-frame))) | 145 | (fset 'vip-iconify (symbol-function 'iconify-or-deiconify-frame))) |
| 148 | (fset 'vip-raise-frame (symbol-function 'raise-frame)) | 146 | (cond ((vip-window-display-p) |
| 149 | (fset 'vip-window-frame (symbol-function 'window-frame)) | ||
| 150 | (fset 'vip-select-frame (symbol-function 'select-frame)) | ||
| 151 | (fset 'vip-selected-frame (symbol-function 'selected-frame)) | ||
| 152 | (fset 'vip-frame-selected-window (symbol-function 'frame-selected-window)) | ||
| 153 | (fset 'vip-frame-parameters (symbol-function 'frame-parameters)) | ||
| 154 | (fset 'vip-modify-frame-parameters | ||
| 155 | (symbol-function 'modify-frame-parameters)) | ||
| 156 | (cond (window-system | ||
| 157 | (fset 'vip-get-face (symbol-function 'internal-get-face)) | 147 | (fset 'vip-get-face (symbol-function 'internal-get-face)) |
| 158 | (fset 'vip-color-defined-p (symbol-function 'x-color-defined-p)) | 148 | (fset 'vip-color-defined-p (symbol-function 'x-color-defined-p)) |
| 159 | (fset 'vip-display-color-p (symbol-function 'x-display-color-p))))) | 149 | ))) |
| 150 | |||
| 151 | (defsubst vip-color-display-p () | ||
| 152 | (if vip-emacs-p | ||
| 153 | (x-display-color-p) | ||
| 154 | (eq (device-class (selected-device)) 'color))) | ||
| 160 | 155 | ||
| 161 | ;; OS/2 | 156 | ;; OS/2 |
| 162 | (cond ((eq window-system 'pm) | 157 | (cond ((eq (vip-device-type) 'pm) |
| 163 | (fset 'vip-color-defined-p | 158 | (fset 'vip-color-defined-p |
| 164 | (function (lambda (color) (assoc color pm-color-alist)))))) | 159 | (function (lambda (color) (assoc color pm-color-alist)))))) |
| 165 | 160 | ||
| @@ -171,20 +166,21 @@ | |||
| 171 | 166 | ||
| 172 | ;; test if display is color and the colors are defined | 167 | ;; test if display is color and the colors are defined |
| 173 | (defsubst vip-can-use-colors (&rest colors) | 168 | (defsubst vip-can-use-colors (&rest colors) |
| 174 | (if (vip-display-color-p) | 169 | (if (vip-color-display-p) |
| 175 | (not (memq nil (mapcar 'vip-color-defined-p colors))) | 170 | (not (memq nil (mapcar 'vip-color-defined-p colors))) |
| 176 | )) | 171 | )) |
| 177 | 172 | ||
| 178 | ;; currently doesn't work for XEmacs | 173 | ;; currently doesn't work for XEmacs |
| 179 | (defun vip-change-cursor-color (new-color) | 174 | (defun vip-change-cursor-color (new-color) |
| 180 | (if (and window-system (vip-display-color-p) | 175 | (if (and (vip-window-display-p) (vip-color-display-p) |
| 181 | (stringp new-color) (vip-color-defined-p new-color)) | 176 | (stringp new-color) (vip-color-defined-p new-color) |
| 182 | (vip-modify-frame-parameters | 177 | (not (string= new-color (vip-get-cursor-color)))) |
| 183 | (vip-selected-frame) (list (cons 'cursor-color new-color))))) | 178 | (modify-frame-parameters |
| 179 | (selected-frame) (list (cons 'cursor-color new-color))))) | ||
| 184 | 180 | ||
| 185 | (defsubst vip-save-cursor-color () | 181 | (defsubst vip-save-cursor-color () |
| 186 | (if (and window-system (vip-display-color-p)) | 182 | (if (and (vip-window-display-p) (vip-color-display-p)) |
| 187 | (let ((color (cdr (assoc 'cursor-color (vip-frame-parameters))))) | 183 | (let ((color (vip-get-cursor-color))) |
| 188 | (if (and (stringp color) (vip-color-defined-p color) | 184 | (if (and (stringp color) (vip-color-defined-p color) |
| 189 | (not (string= color vip-replace-overlay-cursor-color))) | 185 | (not (string= color vip-replace-overlay-cursor-color))) |
| 190 | (vip-overlay-put vip-replace-overlay 'vip-cursor-color color))))) | 186 | (vip-overlay-put vip-replace-overlay 'vip-cursor-color color))))) |
| @@ -192,6 +188,9 @@ | |||
| 192 | (defsubst vip-restore-cursor-color () | 188 | (defsubst vip-restore-cursor-color () |
| 193 | (vip-change-cursor-color | 189 | (vip-change-cursor-color |
| 194 | (vip-overlay-get vip-replace-overlay 'vip-cursor-color))) | 190 | (vip-overlay-get vip-replace-overlay 'vip-cursor-color))) |
| 191 | |||
| 192 | (defsubst vip-get-cursor-color () | ||
| 193 | (cdr (assoc 'cursor-color (frame-parameters)))) | ||
| 195 | 194 | ||
| 196 | 195 | ||
| 197 | ;; Check the current version against the major and minor version numbers | 196 | ;; Check the current version against the major and minor version numbers |
| @@ -220,20 +219,31 @@ | |||
| 220 | (error "%S: Invalid op in vip-check-version" op)))) | 219 | (error "%S: Invalid op in vip-check-version" op)))) |
| 221 | (cond ((memq op '(= > >=)) nil) | 220 | (cond ((memq op '(= > >=)) nil) |
| 222 | ((memq op '(< <=)) t)))) | 221 | ((memq op '(< <=)) t)))) |
| 223 | 222 | ||
| 224 | 223 | ;; warn if it is a wrong emacs | |
| 225 | ;; Early versions of XEmacs didn't have window-live-p (or it didn't work right) | 224 | (if (or (vip-check-version '< 19 29 'emacs) |
| 226 | (if (vip-check-version '< 19 11 'xemacs) | 225 | (vip-check-version '< 19 12 'xemacs)) |
| 227 | (defun window-live-p (win) | 226 | (progn |
| 228 | (let ((visible nil)) | 227 | (with-output-to-temp-buffer " *vip-info*" |
| 229 | (walk-windows | 228 | (switch-to-buffer " *vip-info*") |
| 230 | '(lambda (walk-win) | 229 | (insert |
| 231 | (if(equal walk-win win) | 230 | (format " |
| 232 | (setq visible t))) | 231 | |
| 233 | nil 'all-screens) | 232 | This version of Viper requires |
| 234 | visible)) | 233 | |
| 235 | ) | 234 | \t Emacs 19.29 and higher |
| 235 | \t OR | ||
| 236 | \t XEmacs 19.12 and higher | ||
| 237 | |||
| 238 | It is unlikely to work under Emacs version %s | ||
| 239 | that you are using... | ||
| 236 | 240 | ||
| 241 | Type any key to continue..." emacs-version)) | ||
| 242 | (beep 1) | ||
| 243 | (beep 1) | ||
| 244 | (vip-read-event)) | ||
| 245 | (kill-buffer " *vip-info*"))) | ||
| 246 | |||
| 237 | 247 | ||
| 238 | (defun vip-get-visible-buffer-window (wind) | 248 | (defun vip-get-visible-buffer-window (wind) |
| 239 | (if vip-xemacs-p | 249 | (if vip-xemacs-p |
| @@ -241,12 +251,12 @@ | |||
| 241 | (get-buffer-window wind 'visible))) | 251 | (get-buffer-window wind 'visible))) |
| 242 | 252 | ||
| 243 | 253 | ||
| 254 | ;; Return line position. | ||
| 255 | ;; If pos is 'start then returns position of line start. | ||
| 256 | ;; If pos is 'end, returns line end. If pos is 'mid, returns line center. | ||
| 257 | ;; Pos = 'indent returns beginning of indentation. | ||
| 258 | ;; Otherwise, returns point. Current point is not moved in any case." | ||
| 244 | (defun vip-line-pos (pos) | 259 | (defun vip-line-pos (pos) |
| 245 | "Return line position. | ||
| 246 | If pos is 'start then returns position of line start. | ||
| 247 | If pos is 'end, returns line end. If pos is 'mid, returns line center. | ||
| 248 | Pos = 'indent returns beginning of indentation. | ||
| 249 | Otherwise, returns point. Current point is not moved in any case." | ||
| 250 | (let ((cur-pos (point)) | 260 | (let ((cur-pos (point)) |
| 251 | (result)) | 261 | (result)) |
| 252 | (cond | 262 | (cond |
| @@ -264,50 +274,51 @@ Otherwise, returns point. Current point is not moved in any case." | |||
| 264 | result)) | 274 | result)) |
| 265 | 275 | ||
| 266 | 276 | ||
| 277 | ;; Like move-marker but creates a virgin marker if arg isn't already a marker. | ||
| 278 | ;; The first argument must eval to a variable name. | ||
| 279 | ;; Arguments: (var-name position &optional buffer). | ||
| 280 | ;; | ||
| 281 | ;; This is useful for moving markers that are supposed to be local. | ||
| 282 | ;; For this, VAR-NAME should be made buffer-local with nil as a default. | ||
| 283 | ;; Then, each time this var is used in `vip-move-marker-locally' in a new | ||
| 284 | ;; buffer, a new marker will be created. | ||
| 267 | (defun vip-move-marker-locally (var pos &optional buffer) | 285 | (defun vip-move-marker-locally (var pos &optional buffer) |
| 268 | "Like move-marker but creates a virgin marker if arg isn't already a marker. | ||
| 269 | The first argument must eval to a variable name. | ||
| 270 | Arguments: (var-name position &optional buffer). | ||
| 271 | |||
| 272 | This is useful for moving markers that are supposed to be local. | ||
| 273 | For this, VAR-NAME should be made buffer-local with nil as a default. | ||
| 274 | Then, each time this var is used in `vip-move-marker-locally' in a new | ||
| 275 | buffer, a new marker will be created." | ||
| 276 | (if (markerp (eval var)) | 286 | (if (markerp (eval var)) |
| 277 | () | 287 | () |
| 278 | (set var (make-marker))) | 288 | (set var (make-marker))) |
| 279 | (move-marker (eval var) pos buffer)) | 289 | (move-marker (eval var) pos buffer)) |
| 280 | 290 | ||
| 281 | 291 | ||
| 292 | ;; Print CONDITIONS as a message. | ||
| 282 | (defun vip-message-conditions (conditions) | 293 | (defun vip-message-conditions (conditions) |
| 283 | "Print CONDITIONS as a message." | ||
| 284 | (let ((case (car conditions)) (msg (cdr conditions))) | 294 | (let ((case (car conditions)) (msg (cdr conditions))) |
| 285 | (if (null msg) | 295 | (if (null msg) |
| 286 | (message "%s" case) | 296 | (message "%s" case) |
| 287 | (message "%s: %s" case (mapconcat 'prin1-to-string msg " "))) | 297 | (message "%s: %s" case (mapconcat 'prin1-to-string msg " "))) |
| 288 | (beep 1))) | 298 | (beep 1))) |
| 289 | 299 | ||
| 300 | |||
| 290 | 301 | ||
| 291 | ;;; List/alist utilities | 302 | ;;; List/alist utilities |
| 292 | 303 | ||
| 304 | ;; Convert LIST to an alist | ||
| 293 | (defun vip-list-to-alist (lst) | 305 | (defun vip-list-to-alist (lst) |
| 294 | "Convert LIST to an alist." | ||
| 295 | (let ((alist)) | 306 | (let ((alist)) |
| 296 | (while lst | 307 | (while lst |
| 297 | (setq alist (cons (list (car lst)) alist)) | 308 | (setq alist (cons (list (car lst)) alist)) |
| 298 | (setq lst (cdr lst))) | 309 | (setq lst (cdr lst))) |
| 299 | alist)) | 310 | alist)) |
| 300 | 311 | ||
| 312 | ;; Convert ALIST to a list. | ||
| 301 | (defun vip-alist-to-list (alst) | 313 | (defun vip-alist-to-list (alst) |
| 302 | "Convert ALIST to a list." | ||
| 303 | (let ((lst)) | 314 | (let ((lst)) |
| 304 | (while alst | 315 | (while alst |
| 305 | (setq lst (cons (car (car alst)) lst)) | 316 | (setq lst (cons (car (car alst)) lst)) |
| 306 | (setq alst (cdr alst))) | 317 | (setq alst (cdr alst))) |
| 307 | lst)) | 318 | lst)) |
| 308 | 319 | ||
| 320 | ;; Filter ALIST using REGEXP. Return alist whose elements match the regexp. | ||
| 309 | (defun vip-filter-alist (regexp alst) | 321 | (defun vip-filter-alist (regexp alst) |
| 310 | "Filter ALIST using REGEXP. Return alist whose elements match the regexp." | ||
| 311 | (interactive "s x") | 322 | (interactive "s x") |
| 312 | (let ((outalst) (inalst alst)) | 323 | (let ((outalst) (inalst alst)) |
| 313 | (while (car inalst) | 324 | (while (car inalst) |
| @@ -316,8 +327,8 @@ buffer, a new marker will be created." | |||
| 316 | (setq inalst (cdr inalst))) | 327 | (setq inalst (cdr inalst))) |
| 317 | outalst)) | 328 | outalst)) |
| 318 | 329 | ||
| 330 | ;; Filter LIST using REGEXP. Return list whose elements match the regexp. | ||
| 319 | (defun vip-filter-list (regexp lst) | 331 | (defun vip-filter-list (regexp lst) |
| 320 | "Filter LIST using REGEXP. Return list whose elements match the regexp." | ||
| 321 | (interactive "s x") | 332 | (interactive "s x") |
| 322 | (let ((outlst) (inlst lst)) | 333 | (let ((outlst) (inlst lst)) |
| 323 | (while (car inlst) | 334 | (while (car inlst) |
| @@ -472,11 +483,11 @@ buffer, a new marker will be created." | |||
| 472 | 483 | ||
| 473 | ;;; Saving settings in custom file | 484 | ;;; Saving settings in custom file |
| 474 | 485 | ||
| 486 | ;; Save the current setting of VAR in CUSTOM-FILE. | ||
| 487 | ;; If given, MESSAGE is a message to be displayed after that. | ||
| 488 | ;; This message is erased after 2 secs, if erase-msg is non-nil. | ||
| 489 | ;; Arguments: var message custom-file &optional erase-message | ||
| 475 | (defun vip-save-setting (var message custom-file &optional erase-msg) | 490 | (defun vip-save-setting (var message custom-file &optional erase-msg) |
| 476 | "Save the current setting of VAR in CUSTOM-FILE. | ||
| 477 | If given, MESSAGE is a message to be displayed after that. | ||
| 478 | This message is erased after 2 secs, if erase-msg is non-nil. | ||
| 479 | Arguments: (vip-save-setting var message custom-file &optional erase-message)" | ||
| 480 | (let* ((var-name (symbol-name var)) | 491 | (let* ((var-name (symbol-name var)) |
| 481 | (var-val (if (boundp var) (eval var))) | 492 | (var-val (if (boundp var) (eval var))) |
| 482 | (regexp (format "^[^;]*%s[ \t\n]*[a-zA-Z---_']*[ \t\n)]" var-name)) | 493 | (regexp (format "^[^;]*%s[ \t\n]*[a-zA-Z---_']*[ \t\n)]" var-name)) |
| @@ -530,7 +541,7 @@ Arguments: (vip-save-setting var message custom-file &optional erase-message)" | |||
| 530 | (match-beginning 0) (match-end 0) (current-buffer)))) | 541 | (match-beginning 0) (match-end 0) (current-buffer)))) |
| 531 | 542 | ||
| 532 | (vip-overlay-put vip-search-overlay 'priority vip-search-overlay-priority) | 543 | (vip-overlay-put vip-search-overlay 'priority vip-search-overlay-priority) |
| 533 | (if window-system | 544 | (if (vip-window-display-p) |
| 534 | (progn | 545 | (progn |
| 535 | (vip-overlay-put vip-search-overlay 'face vip-search-face) | 546 | (vip-overlay-put vip-search-overlay 'face vip-search-face) |
| 536 | (sit-for 2) | 547 | (sit-for 2) |
| @@ -552,7 +563,7 @@ Arguments: (vip-save-setting var message custom-file &optional erase-message)" | |||
| 552 | (vip-overlay-end vip-replace-overlay))) | 563 | (vip-overlay-end vip-replace-overlay))) |
| 553 | (vip-overlay-put | 564 | (vip-overlay-put |
| 554 | vip-replace-overlay 'priority vip-replace-overlay-priority)) | 565 | vip-replace-overlay 'priority vip-replace-overlay-priority)) |
| 555 | (if window-system | 566 | (if (vip-window-display-p) |
| 556 | (vip-overlay-put vip-replace-overlay 'face vip-replace-overlay-face)) | 567 | (vip-overlay-put vip-replace-overlay 'face vip-replace-overlay-face)) |
| 557 | (vip-save-cursor-color) | 568 | (vip-save-cursor-color) |
| 558 | (vip-change-cursor-color vip-replace-overlay-cursor-color) | 569 | (vip-change-cursor-color vip-replace-overlay-cursor-color) |
| @@ -560,10 +571,18 @@ Arguments: (vip-save-setting var message custom-file &optional erase-message)" | |||
| 560 | 571 | ||
| 561 | 572 | ||
| 562 | (defsubst vip-hide-replace-overlay () | 573 | (defsubst vip-hide-replace-overlay () |
| 574 | (vip-set-replace-overlay-glyphs nil nil) | ||
| 563 | (vip-restore-cursor-color) | 575 | (vip-restore-cursor-color) |
| 564 | (if window-system | 576 | (if (vip-window-display-p) |
| 565 | (vip-overlay-put vip-replace-overlay 'face nil))) | 577 | (vip-overlay-put vip-replace-overlay 'face nil))) |
| 566 | 578 | ||
| 579 | (defsubst vip-set-replace-overlay-glyphs (before-glyph after-glyph) | ||
| 580 | (if (or (not (vip-window-display-p)) | ||
| 581 | vip-use-replace-region-delimiters) | ||
| 582 | (let ((before-name (if vip-xemacs-p 'begin-glyph 'before-string)) | ||
| 583 | (after-name (if vip-xemacs-p 'end-glyph 'after-string))) | ||
| 584 | (vip-overlay-put vip-replace-overlay before-name before-glyph) | ||
| 585 | (vip-overlay-put vip-replace-overlay after-name after-glyph)))) | ||
| 567 | 586 | ||
| 568 | 587 | ||
| 569 | (defsubst vip-replace-start () | 588 | (defsubst vip-replace-start () |
| @@ -583,10 +602,10 @@ Arguments: (vip-save-setting var message custom-file &optional erase-message)" | |||
| 583 | (vip-check-minibuffer-overlay) | 602 | (vip-check-minibuffer-overlay) |
| 584 | ;; We always move the minibuffer overlay, since in XEmacs | 603 | ;; We always move the minibuffer overlay, since in XEmacs |
| 585 | ;; this overlay may get detached. Moving will reattach it. | 604 | ;; this overlay may get detached. Moving will reattach it. |
| 586 | ;; This overlay is also moved via the post-command-hook, | 605 | ;; This overlay is also moved via the vip-post-command-hook, |
| 587 | ;; to insure taht it covers the whole minibuffer. | 606 | ;; to insure that it covers the whole minibuffer. |
| 588 | (vip-move-minibuffer-overlay) | 607 | (vip-move-minibuffer-overlay) |
| 589 | (if window-system | 608 | (if (vip-window-display-p) |
| 590 | (progn | 609 | (progn |
| 591 | (vip-overlay-put | 610 | (vip-overlay-put |
| 592 | vip-minibuffer-overlay 'face vip-minibuffer-current-face) | 611 | vip-minibuffer-overlay 'face vip-minibuffer-current-face) |
| @@ -616,8 +635,8 @@ Arguments: (vip-save-setting var message custom-file &optional erase-message)" | |||
| 616 | 635 | ||
| 617 | ;;; XEmacs compatibility | 636 | ;;; XEmacs compatibility |
| 618 | 637 | ||
| 619 | ;; Sit for VAL miliseconds. XEmacs doesn't support the milisecond arg to | 638 | ;; Sit for VAL miliseconds. XEmacs doesn't support the millisecond arg |
| 620 | ;; sit-for, so this is for compatibility. | 639 | ;; in sit-for, so this function smoothes out the differences. |
| 621 | (defsubst vip-sit-for-short (val &optional nodisp) | 640 | (defsubst vip-sit-for-short (val &optional nodisp) |
| 622 | (if vip-xemacs-p | 641 | (if vip-xemacs-p |
| 623 | (sit-for (/ val 1000.0) nodisp) | 642 | (sit-for (/ val 1000.0) nodisp) |
| @@ -677,7 +696,7 @@ Arguments: (vip-save-setting var message custom-file &optional erase-message)" | |||
| 677 | )) | 696 | )) |
| 678 | 697 | ||
| 679 | 698 | ||
| 680 | ;; Enacs has a bug in eventp, which causes (eventp nil) to return (nil) | 699 | ;; Emacs has a bug in eventp, which causes (eventp nil) to return (nil) |
| 681 | ;; instead of nil, if '(nil) was previously inadvertantly assigned to | 700 | ;; instead of nil, if '(nil) was previously inadvertantly assigned to |
| 682 | ;; unread-command-events | 701 | ;; unread-command-events |
| 683 | (defun vip-event-key (event) | 702 | (defun vip-event-key (event) |
| @@ -691,17 +710,24 @@ Arguments: (vip-save-setting var message custom-file &optional erase-message)" | |||
| 691 | (cond ((key-press-event-p event) | 710 | (cond ((key-press-event-p event) |
| 692 | (event-key event)) | 711 | (event-key event)) |
| 693 | ((button-event-p event) | 712 | ((button-event-p event) |
| 694 | (concat "mouse-" (event-button event))) | 713 | (concat "mouse-" (prin1-to-string (event-button event)))) |
| 695 | (t | 714 | (t |
| 696 | (error "vip-event-key: Unknown event, %S" event)))) | 715 | (error "vip-event-key: Unknown event, %S" event)))) |
| 697 | (t | 716 | (t |
| 698 | ;; Emacs doesn't handle capital letters correctly, since | 717 | ;; Emacs doesn't handle capital letters correctly, since |
| 699 | ;; \S-a isn't considered the same as A (it behaves as | 718 | ;; \S-a isn't considered the same as A (it behaves as |
| 700 | ;; plain `a' instead). So we take care of this here | 719 | ;; plain `a' instead). So we take care of this here |
| 701 | (if (and (numberp event) (<= ?A event) (<= event ?Z)) | 720 | (cond ((and (numberp event) (<= ?A event) (<= event ?Z)) |
| 702 | (setq mod nil | 721 | (setq mod nil |
| 703 | event event) | 722 | event event)) |
| 704 | (event-basic-type event))))) | 723 | ;; Emacs has the oddity whereby characters 128+char |
| 724 | ;; represent M-char *if* this appears inside a string. | ||
| 725 | ;; So, we convert them manually into (mata char). | ||
| 726 | ((and (numberp event) (< ?\C-? event) (<= event 255)) | ||
| 727 | (setq mod '(meta) | ||
| 728 | event (- event ?\C-? 1))) | ||
| 729 | (t (event-basic-type event))) | ||
| 730 | ))) | ||
| 705 | 731 | ||
| 706 | (if (numberp basis) | 732 | (if (numberp basis) |
| 707 | (setq basis | 733 | (setq basis |