aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1995-06-09 00:12:29 +0000
committerKarl Heuer1995-06-09 00:12:29 +0000
commit546fe0858022086ec83486b992f208825ca3755f (patch)
tree653e4728c3ca6cbb5dd0eabcc92564972bf9e822
parent75551c46fbeae986ee4cf3746d6e9e804cd339ae (diff)
downloademacs-546fe0858022086ec83486b992f208825ca3755f.tar.gz
emacs-546fe0858022086ec83486b992f208825ca3755f.zip
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-keym.el12
-rw-r--r--lisp/emulation/viper-macs.el27
-rw-r--r--lisp/emulation/viper-mous.el50
3 files changed, 48 insertions, 41 deletions
diff --git a/lisp/emulation/viper-keym.el b/lisp/emulation/viper-keym.el
index 2e59a7b87ff..606f17324c0 100644
--- a/lisp/emulation/viper-keym.el
+++ b/lisp/emulation/viper-keym.el
@@ -1,6 +1,5 @@
1;;; viper-keym.el -- Main Viper keymaps 1;;; viper-keym.el -- Main Viper keymaps
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
@@ -89,6 +88,11 @@ vip-insert-basic-map. Not recommended, except for novice users.")
89;; This keymap should stay empty 88;; This keymap should stay empty
90(defvar vip-empty-keymap (make-sparse-keymap)) 89(defvar vip-empty-keymap (make-sparse-keymap))
91 90
91;; This was the main Vi mode in old versions of VIP which may have been
92;; extensively used by VIP users. We declare it as a global var
93;; and, after .vip is loaded, we add this keymap to vip-vi-basic-map.
94(defvar vip-mode-map (make-sparse-keymap))
95
92 96
93;;; Variables used by minor modes 97;;; Variables used by minor modes
94 98
@@ -294,7 +298,7 @@ vip-insert-basic-map. Not recommended, except for novice users.")
294(define-key vip-vi-basic-map "t" 'vip-goto-char-forward) 298(define-key vip-vi-basic-map "t" 'vip-goto-char-forward)
295(define-key vip-vi-basic-map "u" 'vip-undo) 299(define-key vip-vi-basic-map "u" 'vip-undo)
296(define-key vip-vi-basic-map "v" 'find-file) 300(define-key vip-vi-basic-map "v" 'find-file)
297(define-key vip-vi-basic-map "\C-v" 'vip-find-file-other-frame) 301(define-key vip-vi-basic-map "\C-v" 'find-file-other-frame)
298(define-key vip-vi-basic-map "w" 'vip-forward-word) 302(define-key vip-vi-basic-map "w" 'vip-forward-word)
299(define-key vip-vi-basic-map "x" 'vip-delete-char) 303(define-key vip-vi-basic-map "x" 'vip-delete-char)
300(define-key vip-vi-basic-map "y" 'vip-command-argument) 304(define-key vip-vi-basic-map "y" 'vip-command-argument)
@@ -428,8 +432,8 @@ Arguments: (major-mode vip-state keymap)"
428 (vip-set-mode-vars-for vip-current-state))) 432 (vip-set-mode-vars-for vip-current-state)))
429 433
430 434
435;; Displays variables that control Viper's keymaps
431(defun vip-debug-keymaps () 436(defun vip-debug-keymaps ()
432 "Displays variables that control Viper's keymaps."
433 (interactive) 437 (interactive)
434 (with-output-to-temp-buffer " *vip-debug*" 438 (with-output-to-temp-buffer " *vip-debug*"
435 (princ (format "Buffer name: %s\n\n" (buffer-name))) 439 (princ (format "Buffer name: %s\n\n" (buffer-name)))
diff --git a/lisp/emulation/viper-macs.el b/lisp/emulation/viper-macs.el
index 1b001636100..5cce77a5874 100644
--- a/lisp/emulation/viper-macs.el
+++ b/lisp/emulation/viper-macs.el
@@ -1,6 +1,5 @@
1;;; viper-macs.el -- functions implementing keyboard macros for Viper 1;;; viper-macs.el -- functions implementing keyboard macros for Viper
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
@@ -45,7 +44,7 @@
45 "Vector of keys representing the name of last Viper keyboard macro.") 44 "Vector of keys representing the name of last Viper keyboard macro.")
46 45
47(defconst vip-fast-keyseq-timeout 200 46(defconst vip-fast-keyseq-timeout 200
48 "*Key sequences separated by this many miliseconds are interpreted as a macro, if such a macro is defined. 47 "*Key sequence separated by no more than this many milliseconds is viewed as a macro, if such a macro is defined.
49This also controls ESC-keysequences generated by keyboard function keys.") 48This also controls ESC-keysequences generated by keyboard function keys.")
50 49
51 50
@@ -62,8 +61,8 @@ a key is a symbol, e.g., `a', `\\1', `f2', etc., or a list, e.g.,
62 61
63;;; Code 62;;; Code
64 63
64;; Ex map command
65(defun ex-map () 65(defun ex-map ()
66 "Ex map command."
67 (let ((mod-char "") 66 (let ((mod-char "")
68 macro-name macro-body map-args ins) 67 macro-name macro-body map-args ins)
69 (save-window-excursion 68 (save-window-excursion
@@ -93,8 +92,8 @@ a key is a symbol, e.g., `a', `\\1', `f2', etc., or a list, e.g.,
93 )) 92 ))
94 93
95 94
95;; Ex unmap
96(defun ex-unmap () 96(defun ex-unmap ()
97 "Ex unmap."
98 (let ((mod-char "") 97 (let ((mod-char "")
99 temp macro-name ins) 98 temp macro-name ins)
100 (save-window-excursion 99 (save-window-excursion
@@ -178,8 +177,8 @@ a key is a symbol, e.g., `a', `\\1', `f2', etc., or a list, e.g.,
178 (setq macro-body (vip-char-array-to-macro macro-body))) 177 (setq macro-body (vip-char-array-to-macro macro-body)))
179 ((vectorp macro-body) nil) 178 ((vectorp macro-body) nil)
180 (t (error "map: Invalid syntax in macro definition")))) 179 (t (error "map: Invalid syntax in macro definition"))))
181 (cons macro-name macro-body) 180 (setq cursor-in-echo-area nil)(sit-for 0) ; this overcomes xemacs tty bug
182 )) 181 (cons macro-name macro-body)))
183 182
184 183
185 184
@@ -444,6 +443,12 @@ If SCOPE is nil, the user is asked to specify the scope."
444 443
445;; macro name must be a vector of vip-style keys 444;; macro name must be a vector of vip-style keys
446(defun vip-unrecord-kbd-macro (macro-name state) 445(defun vip-unrecord-kbd-macro (macro-name state)
446 "Delete macro MACRO-NAME from Viper STATE.
447MACRO-NAME must be a vector of vip-style keys. This command is used by Viper
448internally, but the user can also use it in ~/.vip to delete pre-defined macros
449supplied with Viper. The best way to avoid mistakes in macro names to be passed
450to this function is to use vip-describe-kbd-macros and copy the name from
451there."
447 (let* (state-name keymap 452 (let* (state-name keymap
448 (macro-alist-var 453 (macro-alist-var
449 (cond ((eq state 'vi-state) 454 (cond ((eq state 'vi-state)
@@ -521,7 +526,7 @@ If SCOPE is nil, the user is asked to specify the scope."
521 )) 526 ))
522 )) 527 ))
523 528
524;; Checks if MACRO-ALIST has an entry for a macro name starting with 529;; Check if MACRO-ALIST has an entry for a macro name starting with
525;; CHAR. If not, this indicates that the binding for this char 530;; CHAR. If not, this indicates that the binding for this char
526;; in vip-vi/insert-kbd-map can be released. 531;; in vip-vi/insert-kbd-map can be released.
527(defun vip-can-release-key (char macro-alist) 532(defun vip-can-release-key (char macro-alist)
@@ -751,8 +756,8 @@ If SCOPE is nil, the user is asked to specify the scope."
751 (setq candidates (delq nil candidates)))) 756 (setq candidates (delq nil candidates))))
752 757
753 758
754;; if seq of key symbols can be converted to a string--do so. Otherwise, do 759;; if seq of Viper key symbols (representing a macro) can be converted to a
755;; nothing. 760;; string--do so. Otherwise, do nothing.
756(defun vip-display-macro (macro-name) 761(defun vip-display-macro (macro-name)
757 (cond ((vip-char-symbol-sequence-p macro-name) 762 (cond ((vip-char-symbol-sequence-p macro-name)
758 (mapconcat 'symbol-name macro-name "")) 763 (mapconcat 'symbol-name macro-name ""))
@@ -763,7 +768,7 @@ If SCOPE is nil, the user is asked to specify the scope."
763(defun vip-events-to-macro (event-seq) 768(defun vip-events-to-macro (event-seq)
764 (vconcat (mapcar 'vip-event-key event-seq))) 769 (vconcat (mapcar 'vip-event-key event-seq)))
765 770
766;; convert strings of characters or arrays of characters to Viper macro form 771;; convert strings or arrays of characters to Viper macro form
767(defun vip-char-array-to-macro (array) 772(defun vip-char-array-to-macro (array)
768 (let ((vec (vconcat array)) 773 (let ((vec (vconcat array))
769 macro) 774 macro)
diff --git a/lisp/emulation/viper-mous.el b/lisp/emulation/viper-mous.el
index e3a31abc855..5f154411830 100644
--- a/lisp/emulation/viper-mous.el
+++ b/lisp/emulation/viper-mous.el
@@ -1,6 +1,5 @@
1;;; viper-mous.el -- Mouse support for Viper 1;;; viper-mous.el -- Mouse support for Viper
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
@@ -30,7 +29,7 @@
30(defvar vip-frame-of-focus nil) 29(defvar vip-frame-of-focus nil)
31 30
32;; Frame that was selected before the switch-frame event. 31;; Frame that was selected before the switch-frame event.
33(defconst vip-pre-click-frame (vip-selected-frame)) 32(defconst vip-current-frame-saved (selected-frame))
34 33
35(defvar vip-surrounding-word-function 'vip-surrounding-word 34(defvar vip-surrounding-word-function 'vip-surrounding-word
36 "*Function that determines what constitutes a word for clicking events. 35 "*Function that determines what constitutes a word for clicking events.
@@ -67,7 +66,7 @@ considered related.")
67 66
68;;; Code 67;;; Code
69 68
70(defun vip-multiclick-p () 69(defsubst vip-multiclick-p ()
71 (not (vip-sit-for-short vip-multiclick-timeout t))) 70 (not (vip-sit-for-short vip-multiclick-timeout t)))
72 71
73(defun vip-surrounding-word (count click-count) 72(defun vip-surrounding-word (count click-count)
@@ -188,27 +187,26 @@ Click may be in another window. Current window and buffer isn't changed."
188 (error "Click must be over a window.")) 187 (error "Click must be over a window."))
189 click-word)))) 188 click-word))))
190 189
191(defun vip-mouse-click-frame (click) 190;; Returns window where click occurs
192 "Returns window where click occurs." 191(defsubst vip-mouse-click-frame (click)
193 (vip-window-frame (vip-mouse-click-window click))) 192 (window-frame (vip-mouse-click-window click)))
194 193
195(defun vip-mouse-click-window (click) 194;; Returns window where click occurs
196 "Returns window where click occurs." 195(defsubst vip-mouse-click-window (click)
197 (if vip-xemacs-p 196 (if vip-xemacs-p
198 (event-window click) 197 (event-window click)
199 (posn-window (event-start click)))) 198 (posn-window (event-start click))))
200 199
201(defun vip-mouse-click-window-buffer (click) 200;; Returns the buffer of the window where click occurs
202 "Returns the buffer of the window where click occurs." 201(defsubst vip-mouse-click-window-buffer (click)
203 (window-buffer (vip-mouse-click-window click))) 202 (window-buffer (vip-mouse-click-window click)))
204 203
205(defun vip-mouse-click-window-buffer-name (click) 204;; Returns the name of the buffer in the window where click occurs
206 "Returns the name of the buffer in the window where click occurs." 205(defsubst vip-mouse-click-window-buffer-name (click)
207 (buffer-name (vip-mouse-click-window-buffer click))) 206 (buffer-name (vip-mouse-click-window-buffer click)))
208 207
209(defun vip-mouse-click-posn (click) 208;; Returns position of a click
210 "Returns position of a click." 209(defsubst vip-mouse-click-posn (click)
211 (interactive "e")
212 (if vip-xemacs-p 210 (if vip-xemacs-p
213 (event-point click) 211 (event-point click)
214 (posn-point (event-start click)))) 212 (posn-point (event-start click))))
@@ -222,7 +220,7 @@ The double-click action of the same mouse button must not be bound
222See `vip-surrounding-word' for the definition of a word in this case." 220See `vip-surrounding-word' for the definition of a word in this case."
223 (interactive "e\nP") 221 (interactive "e\nP")
224 (if vip-frame-of-focus ;; to handle clicks in another frame 222 (if vip-frame-of-focus ;; to handle clicks in another frame
225 (vip-select-frame vip-frame-of-focus)) 223 (select-frame vip-frame-of-focus))
226 224
227 ;; turn arg into a number 225 ;; turn arg into a number
228 (cond ((numberp arg) nil) 226 (cond ((numberp arg) nil)
@@ -287,7 +285,7 @@ See `vip-surrounding-word' for the details on what constitutes a word for
287this command." 285this command."
288 (interactive "e\nP") 286 (interactive "e\nP")
289 (if vip-frame-of-focus ;; to handle clicks in another frame 287 (if vip-frame-of-focus ;; to handle clicks in another frame
290 (vip-select-frame vip-frame-of-focus)) 288 (select-frame vip-frame-of-focus))
291 (let (click-word click-count 289 (let (click-word click-count
292 (previous-search-string vip-s-string)) 290 (previous-search-string vip-s-string))
293 291
@@ -388,7 +386,7 @@ bindings in viper.el and in the Viper manual."
388 ;; pass prefix arg along to vip-mouse-click-search/insert-word 386 ;; pass prefix arg along to vip-mouse-click-search/insert-word
389 (setq prefix-arg arg) 387 (setq prefix-arg arg)
390 (if (eq last-command 'handle-switch-frame) 388 (if (eq last-command 'handle-switch-frame)
391 (setq vip-frame-of-focus vip-pre-click-frame)) 389 (setq vip-frame-of-focus vip-current-frame-saved))
392 ;; make Emacs forget that it executed vip-mouse-catch-frame-switch 390 ;; make Emacs forget that it executed vip-mouse-catch-frame-switch
393 (setq this-command last-command)) 391 (setq this-command last-command))
394 392
@@ -408,12 +406,12 @@ bindings in viper.el and in the Viper manual."
408;; until you do something other than vip-mouse-click-* command. 406;; until you do something other than vip-mouse-click-* command.
409;; In XEmacs, you have to manually select frame B (with the mouse click) in 407;; In XEmacs, you have to manually select frame B (with the mouse click) in
410;; order to shift focus to frame B. 408;; order to shift focus to frame B.
411(defun vip-save-pre-click-frame (frame) 409(defsubst vip-remember-current-frame (frame)
412 (setq last-command 'handle-switch-frame) 410 (setq last-command 'handle-switch-frame
413 (setq vip-pre-click-frame (vip-selected-frame))) 411 vip-current-frame-saved (selected-frame)))
414 412
415 413
416(cond (window-system 414(cond ((vip-window-display-p)
417 (let* ((search-key (if vip-xemacs-p [(meta button1up)] [S-mouse-1])) 415 (let* ((search-key (if vip-xemacs-p [(meta button1up)] [S-mouse-1]))
418 (search-key-catch (if vip-xemacs-p 416 (search-key-catch (if vip-xemacs-p
419 [(meta button1)] [S-down-mouse-1])) 417 [(meta button1)] [S-down-mouse-1]))
@@ -445,11 +443,11 @@ bindings in viper.el and in the Viper manual."
445 (global-set-key insert-key-catch 'vip-mouse-catch-frame-switch)) 443 (global-set-key insert-key-catch 'vip-mouse-catch-frame-switch))
446 444
447 (if vip-xemacs-p 445 (if vip-xemacs-p
448 (add-hook 'mouse-leave-screen-hook 446 (add-hook 'mouse-leave-frame-hook
449 'vip-save-pre-click-frame) 447 'vip-remember-current-frame)
450 (defadvice handle-switch-frame (before vip-frame-advice activate) 448 (defadvice handle-switch-frame (before vip-frame-advice activate)
451 "Remember the selected frame before the switch-frame event." 449 "Remember the selected frame before the switch-frame event."
452 (vip-save-pre-click-frame (vip-selected-frame)))) 450 (vip-remember-current-frame (selected-frame))))
453 ))) 451 )))
454 452
455 453