changeset 12140:75379a19c5d5

Changed vip-*-frame-* to *-frame-*, incorporated overlay strings, unread-command-events, removed support for emacs versions 19.28 and xemacs 19.11 and earlier.
author Karl Heuer <kwzh@gnu.org>
date Fri, 09 Jun 1995 00:12:29 +0000
parents e16c06646396
children 9265a67ccf1a
files lisp/emulation/viper-keym.el lisp/emulation/viper-macs.el lisp/emulation/viper-mous.el
diffstat 3 files changed, 48 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emulation/viper-keym.el	Fri Jun 09 00:11:53 1995 +0000
+++ b/lisp/emulation/viper-keym.el	Fri Jun 09 00:12:29 1995 +0000
@@ -1,6 +1,5 @@
 ;;; viper-keym.el -- Main Viper keymaps
-
-;; Copyright (C) 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -89,6 +88,11 @@
 ;; This keymap should stay empty
 (defvar vip-empty-keymap (make-sparse-keymap))
 
+;; This was the main Vi mode in old versions of VIP which may have been
+;; extensively used by VIP users. We declare it as a global var
+;; and, after .vip is loaded, we add this keymap to vip-vi-basic-map.
+(defvar vip-mode-map (make-sparse-keymap))
+
 
 ;;; Variables used by minor modes
 
@@ -294,7 +298,7 @@
 (define-key vip-vi-basic-map "t" 'vip-goto-char-forward)
 (define-key vip-vi-basic-map "u" 'vip-undo)
 (define-key vip-vi-basic-map "v" 'find-file)
-(define-key vip-vi-basic-map "\C-v" 'vip-find-file-other-frame)
+(define-key vip-vi-basic-map "\C-v" 'find-file-other-frame)
 (define-key vip-vi-basic-map "w" 'vip-forward-word)
 (define-key vip-vi-basic-map "x" 'vip-delete-char)
 (define-key vip-vi-basic-map "y" 'vip-command-argument)
@@ -428,8 +432,8 @@
     (vip-set-mode-vars-for vip-current-state)))
 
     
+;; Displays variables that control Viper's keymaps
 (defun vip-debug-keymaps ()
-  "Displays variables that control Viper's keymaps."
   (interactive)
   (with-output-to-temp-buffer " *vip-debug*"
     (princ (format "Buffer name:  %s\n\n" (buffer-name)))
--- a/lisp/emulation/viper-macs.el	Fri Jun 09 00:11:53 1995 +0000
+++ b/lisp/emulation/viper-macs.el	Fri Jun 09 00:12:29 1995 +0000
@@ -1,6 +1,5 @@
 ;;; viper-macs.el -- functions implementing keyboard macros for Viper
-
-;; Copyright (C) 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -45,7 +44,7 @@
   "Vector of keys representing the name of last Viper keyboard macro.")
 
 (defconst vip-fast-keyseq-timeout 200
-  "*Key sequences separated by this many miliseconds are interpreted as a macro, if such a macro is defined.
+  "*Key sequence separated by no more than this many milliseconds is viewed as a macro, if such a macro is defined.
 This also controls ESC-keysequences generated by keyboard function keys.")
 
 
@@ -62,8 +61,8 @@
 
 ;;; Code
 
+;; Ex map command
 (defun ex-map ()
-  "Ex map command."
   (let ((mod-char "")
 	macro-name macro-body map-args ins)
     (save-window-excursion
@@ -93,8 +92,8 @@
     ))
     
 
+;; Ex unmap
 (defun ex-unmap ()
-  "Ex unmap."
   (let ((mod-char "")
 	temp macro-name ins)
     (save-window-excursion
@@ -178,8 +177,8 @@
 	       (setq macro-body (vip-char-array-to-macro macro-body)))
 	      ((vectorp macro-body) nil)
 	      (t (error "map: Invalid syntax in macro definition"))))
-    (cons macro-name macro-body)
-    ))
+    (setq cursor-in-echo-area nil)(sit-for 0) ; this overcomes xemacs tty bug
+    (cons macro-name macro-body)))
     
 
 
@@ -444,6 +443,12 @@
     
 ;; macro name must be a vector of vip-style keys
 (defun vip-unrecord-kbd-macro (macro-name state)
+  "Delete macro MACRO-NAME from Viper STATE.
+MACRO-NAME must be a vector of vip-style keys. This command is used by Viper
+internally, but the user can also use it in ~/.vip to delete pre-defined macros
+supplied with Viper. The best way to avoid mistakes in macro names to be passed
+to this function is to use vip-describe-kbd-macros and copy the name from
+there."
   (let* (state-name keymap 
 	 (macro-alist-var
 	  (cond ((eq state 'vi-state)
@@ -521,7 +526,7 @@
 	  ))
     ))
     
-;; Checks if MACRO-ALIST has an entry for a macro name starting with
+;; Check if MACRO-ALIST has an entry for a macro name starting with
 ;; CHAR. If not, this indicates that the binding for this char
 ;; in vip-vi/insert-kbd-map can be released.
 (defun vip-can-release-key (char macro-alist)
@@ -751,8 +756,8 @@
     (setq candidates (delq nil candidates))))
     
   
-;; if seq of key symbols can be converted to a string--do so. Otherwise, do
-;; nothing.
+;; if seq of Viper key symbols (representing a macro) can be converted to a
+;; string--do so. Otherwise, do nothing.
 (defun vip-display-macro (macro-name)
   (cond ((vip-char-symbol-sequence-p macro-name)
 	 (mapconcat 'symbol-name macro-name ""))
@@ -763,7 +768,7 @@
 (defun vip-events-to-macro (event-seq)
   (vconcat (mapcar 'vip-event-key event-seq)))
   
-;; convert strings of characters or arrays of characters to Viper macro form
+;; convert strings or arrays of characters to Viper macro form
 (defun vip-char-array-to-macro (array)
   (let ((vec (vconcat array))
 	macro)
--- a/lisp/emulation/viper-mous.el	Fri Jun 09 00:11:53 1995 +0000
+++ b/lisp/emulation/viper-mous.el	Fri Jun 09 00:12:29 1995 +0000
@@ -1,6 +1,5 @@
 ;;; viper-mous.el -- Mouse support for Viper
-
-;; Copyright (C) 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -30,7 +29,7 @@
 (defvar vip-frame-of-focus nil)
     
 ;; Frame that was selected before the switch-frame event.
-(defconst vip-pre-click-frame (vip-selected-frame))
+(defconst vip-current-frame-saved (selected-frame))
   
 (defvar vip-surrounding-word-function 'vip-surrounding-word
   "*Function that determines what constitutes a word for clicking events.
@@ -67,7 +66,7 @@
 
 ;;; Code
 
-(defun vip-multiclick-p ()
+(defsubst vip-multiclick-p ()
   (not (vip-sit-for-short vip-multiclick-timeout t)))
 	     
 (defun vip-surrounding-word (count click-count)
@@ -188,27 +187,26 @@
 	  (error "Click must be over a window."))
 	click-word))))
 
-(defun vip-mouse-click-frame (click)
-  "Returns window where click occurs."
-  (vip-window-frame (vip-mouse-click-window click)))
+;; Returns window where click occurs
+(defsubst vip-mouse-click-frame (click)
+  (window-frame (vip-mouse-click-window click)))
 
-(defun vip-mouse-click-window (click)
-  "Returns window where click occurs."
+;; Returns window where click occurs
+(defsubst vip-mouse-click-window (click)
   (if vip-xemacs-p
       (event-window click)
     (posn-window (event-start click))))
 
-(defun vip-mouse-click-window-buffer (click)
-  "Returns the buffer of the window where click occurs."
+;; Returns the buffer of the window where click occurs
+(defsubst vip-mouse-click-window-buffer (click)
   (window-buffer (vip-mouse-click-window click)))
 
-(defun vip-mouse-click-window-buffer-name (click)
-  "Returns the name of the buffer in the window where click occurs."
+;; Returns the name of the buffer in the window where click occurs
+(defsubst vip-mouse-click-window-buffer-name (click)
   (buffer-name (vip-mouse-click-window-buffer click)))
 
-(defun vip-mouse-click-posn (click)
-  "Returns position of a click."
-  (interactive "e")
+;; Returns position of a click
+(defsubst vip-mouse-click-posn (click)
   (if vip-xemacs-p
       (event-point click)
     (posn-point (event-start click))))
@@ -222,7 +220,7 @@
 See `vip-surrounding-word' for the definition of a word in this case."
   (interactive "e\nP")
   (if vip-frame-of-focus	;; to handle clicks in another frame
-      (vip-select-frame vip-frame-of-focus))
+      (select-frame vip-frame-of-focus))
       
   ;; turn arg into a number
   (cond ((numberp arg) nil)
@@ -287,7 +285,7 @@
 this command."
   (interactive "e\nP")
   (if vip-frame-of-focus	;; to handle clicks in another frame
-      (vip-select-frame vip-frame-of-focus))
+      (select-frame vip-frame-of-focus))
   (let (click-word click-count
 	(previous-search-string vip-s-string))
     
@@ -388,7 +386,7 @@
   ;; pass prefix arg along to vip-mouse-click-search/insert-word
   (setq prefix-arg arg)
   (if (eq last-command 'handle-switch-frame)
-      (setq vip-frame-of-focus vip-pre-click-frame))
+      (setq vip-frame-of-focus vip-current-frame-saved))
   ;; make Emacs forget that it executed vip-mouse-catch-frame-switch
   (setq this-command last-command))
       
@@ -408,12 +406,12 @@
 ;; until you do something other than vip-mouse-click-* command.
 ;; In XEmacs, you have to manually select frame B (with the mouse click) in
 ;; order to shift focus to frame B.
-(defun vip-save-pre-click-frame (frame)
-  (setq last-command 'handle-switch-frame)
-  (setq vip-pre-click-frame (vip-selected-frame)))
+(defsubst vip-remember-current-frame (frame)
+  (setq last-command 'handle-switch-frame
+	vip-current-frame-saved (selected-frame)))
 
 
-(cond (window-system
+(cond ((vip-window-display-p)
        (let* ((search-key (if vip-xemacs-p [(meta button1up)] [S-mouse-1]))
 	      (search-key-catch (if vip-xemacs-p
 				    [(meta button1)] [S-down-mouse-1]))
@@ -445,11 +443,11 @@
 	     (global-set-key insert-key-catch   'vip-mouse-catch-frame-switch))
 	 
 	 (if vip-xemacs-p
-	     (add-hook 'mouse-leave-screen-hook
-		       'vip-save-pre-click-frame)
+	     (add-hook 'mouse-leave-frame-hook
+		       'vip-remember-current-frame)
 	   (defadvice handle-switch-frame (before vip-frame-advice activate)
 	     "Remember the selected frame before the switch-frame event." 
-	     (vip-save-pre-click-frame (vip-selected-frame))))
+	     (vip-remember-current-frame (selected-frame))))
        )))