changeset 14581:4951b11970a1

*** empty log message ***
author Michael Kifer <kifer@cs.stonybrook.edu>
date Fri, 16 Feb 1996 05:25:08 +0000
parents 1883960762e0
children c768f6d7daaa
files lisp/emulation/viper-ex.el lisp/emulation/viper-keym.el lisp/emulation/viper-macs.el lisp/emulation/viper-util.el lisp/emulation/viper.el
diffstat 5 files changed, 55 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emulation/viper-ex.el	Fri Feb 16 04:49:12 1996 +0000
+++ b/lisp/emulation/viper-ex.el	Fri Feb 16 05:25:08 1996 +0000
@@ -489,7 +489,7 @@
 		      ))
 		   ))
 	    ((eq ex-token-type 'non-command)
-	     (error (format "`%s': %s" ex-token vip-BadExCommand)))
+	     (error "`%s': %s" ex-token vip-BadExCommand))
 	    ((eq ex-token-type 'whole)
 	     (setq address nil)
 	     (setq ex-addresses
@@ -961,22 +961,18 @@
 	     (string= ex-token "change")
 	     (string= ex-token "insert")
 	     (string= ex-token "open"))
-	 (error
-	  (format "`%s': Obsolete command, not supported by Viper"
-		  ex-token)))
+	 (error "`%s': Obsolete command, not supported by Viper" ex-token))
 	((or (string= ex-token "abbreviate")
 	     (string= ex-token "unabbreviate"))
 	 (error
-	  (format
-	   "`%s': Vi-style abbrevs are obsolete. Use the more powerful Emacs abbrevs"
-	   ex-token)))
+	  "`%s': Vi abbrevs are obsolete. Use the more powerful Emacs abbrevs"
+	  ex-token))
 	((or (string= ex-token "list")
 	     (string= ex-token "print")
 	     (string= ex-token "z")
 	     (string= ex-token "#"))
-	 (error
-	  (format "`%s': Command not implemented in Viper" ex-token)))
-	(t (error (format "`%s': %s" ex-token vip-BadExCommand)))))
+	 (error "`%s': Command not implemented in Viper" ex-token))
+	(t (error "`%s': %s" ex-token vip-BadExCommand))))
 
 (defun vip-undisplayed-files ()
   (mapcar
@@ -1581,7 +1577,7 @@
 		 val "nil")))
     (if (eq val 0) ; value must be set by the user
 	(let ((cursor-in-echo-area t))
-	  (message (format ":set %s = <Value>" var))
+	  (message ":set %s = <Value>" var)
 	  ;; if there are unread events, don't wait
 	  (or (vip-set-unread-command-events "") (sit-for 2))
 	  (setq val (read-string (format ":set %s = " var)))
@@ -1653,9 +1649,9 @@
 		))
 	  ))
     
-    (message (format "%s %s %s" set-cmd var (if (string-match "^[ \t]*$" val)
-						(format "%S" val)
-					      val)))
+    (message "%s %s %s" set-cmd var (if (string-match "^[ \t]*$" val)
+					(format "%S" val)
+				      val))
     (eval (car (read-from-string actual-lisp-cmd)))
 	(if (string= var "fill-column")
 		(if (> val2 0)
@@ -1996,4 +1992,4 @@
 
 (provide 'viper-ex)
 
-;;;  viper-ex.el ends here
+;;;  viper-ex.el ends here
\ No newline at end of file
--- a/lisp/emulation/viper-keym.el	Fri Feb 16 04:49:12 1996 +0000
+++ b/lisp/emulation/viper-keym.el	Fri Feb 16 05:25:08 1996 +0000
@@ -364,6 +364,7 @@
 ;; Keymap for reading file names in Ex-style commands.
 (defvar ex-read-filename-map (make-sparse-keymap))
 (define-key ex-read-filename-map " " 'vip-complete-filename-or-exit)
+(define-key ex-read-filename-map "!" 'vip-handle-!)
 
 
 	  
--- a/lisp/emulation/viper-macs.el	Fri Feb 16 04:49:12 1996 +0000
+++ b/lisp/emulation/viper-macs.el	Fri Feb 16 05:25:08 1996 +0000
@@ -150,10 +150,10 @@
 	     '(?\b ?\d '^? '^H (control h) (control \?) backspace delete))
 	    (setq key-seq (subseq key-seq 0 (- (length key-seq) 2))))
 	(setq message
-	      (format ":map%s %s"
-		 variant (if (> (length key-seq) 0)
-			     (prin1-to-string (vip-display-macro key-seq))
-			   "")))
+	      ":map%s %s"
+	      variant (if (> (length key-seq) 0)
+			  (prin1-to-string (vip-display-macro key-seq))
+			""))
 	(message message)
 	(setq event (vip-read-key))
 	;;(setq event (vip-read-event))
@@ -215,20 +215,20 @@
 	      ((member key '(tab (control i) ?\t))
 	       (setq key-seq (subseq key-seq 0 (1- (length key-seq))))
 	       (setq message 
-		     (format ":unmap%s %s"
-			     variant (if (> (length key-seq) 0)
-					 (prin1-to-string
-					  (vip-display-macro key-seq))
-				       "")))
+		     ":unmap%s %s"
+		     variant (if (> (length key-seq) 0)
+				 (prin1-to-string
+				  (vip-display-macro key-seq))
+			       ""))
 	       (setq key-seq
 		     (vip-do-sequence-completion key-seq macro-alist message))
 	       ))
 	(setq message 
-	      (format ":unmap%s %s"
-		      variant (if (> (length key-seq) 0)
-				  (prin1-to-string
-				   (vip-display-macro key-seq))
-				"")))
+	      ":unmap%s %s"
+	      variant (if (> (length key-seq) 0)
+			  (prin1-to-string
+			   (vip-display-macro key-seq))
+			""))
 	(message message)
 	(setq event (vip-read-key))
 	;;(setq event (vip-read-event))
@@ -641,9 +641,7 @@
     (princ "  none\n"))
   (princ "\n   ** Global:")
   (if (vip-kbd-global-definition macro)
-      (princ 
-       (format "\n           %S" 
-	       (cdr (vip-kbd-global-pair macro))))
+      (princ (format "\n           %S" (cdr (vip-kbd-global-pair macro))))
     (princ "  none"))
   (princ "\n"))
   
@@ -904,7 +902,7 @@
 	       (setq vip-last-macro-reg reg)
 	       (vip-set-register-macro reg))))
 	  (t
-	   (error (format "`%c': Unknown register" reg))))))
+	   (error "`%c': Unknown register" reg)))))
 	   
 
 (defun vip-global-execute ()
--- a/lisp/emulation/viper-util.el	Fri Feb 16 04:49:12 1996 +0000
+++ b/lisp/emulation/viper-util.el	Fri Feb 16 05:25:08 1996 +0000
@@ -31,9 +31,20 @@
       window-system
     (device-type (selected-device))))
 ;; in XEmacs: device-type is tty on tty and stream in batch.
-(defsubst vip-window-display-p ()
+(defun vip-window-display-p ()
   (and (vip-device-type) (not (memq (vip-device-type) '(tty stream)))))
 
+(defvar vip-force-faces nil
+  "If t, Viper will think that it is running on a display that supports faces.
+This is provided as a temporary relief for users of face-capable displays
+that Viper doesn't know about.")
+
+(defun vip-has-face-support-p ()
+  (cond ((vip-window-display-p))
+	(vip-force-faces)
+	(vip-emacs-p (memq (vip-device-type) '(pc)))
+	(vip-xemacs-p (memq (vip-device-type) '(tty pc)))))
+
 
 ;;; Macros
 
@@ -130,7 +141,7 @@
       (fset 'vip-move-overlay (symbol-function 'set-extent-endpoints))
       (if (vip-window-display-p)
 	  (fset 'vip-iconify (symbol-function 'iconify-frame)))
-      (cond ((vip-window-display-p)
+      (cond ((vip-has-face-support-p)
 	     (fset 'vip-get-face (symbol-function 'get-face))
 	     (fset 'vip-color-defined-p
 		   (symbol-function 'valid-color-name-p))
@@ -145,7 +156,7 @@
   (fset 'vip-move-overlay (symbol-function 'move-overlay))
   (if (vip-window-display-p)
       (fset 'vip-iconify (symbol-function 'iconify-or-deiconify-frame)))
-  (cond ((vip-window-display-p)
+  (cond ((vip-has-face-support-p)
 	 (fset 'vip-get-face (symbol-function 'internal-get-face))
 	 (fset 'vip-color-defined-p (symbol-function 'x-color-defined-p))
 	 )))
@@ -173,7 +184,7 @@
     ))
 
 (defun vip-hide-face (face)
-  (if (and (vip-window-display-p) vip-emacs-p)
+  (if (and (vip-has-face-support-p) vip-emacs-p)
       (add-to-list 'facemenu-unlisted-faces face)))
 
 ;; cursor colors
@@ -555,7 +566,7 @@
 	   (match-beginning 0) (match-end 0) (current-buffer))))
   
   (vip-overlay-put vip-search-overlay 'priority vip-search-overlay-priority)
-  (if (vip-window-display-p)
+  (if (vip-has-face-support-p)
       (progn
 	(vip-overlay-put vip-search-overlay 'face vip-search-face)
 	(sit-for 2)
@@ -569,7 +580,7 @@
     (setq vip-replace-overlay (vip-make-overlay beg end (current-buffer)))
     (vip-overlay-put 
      vip-replace-overlay 'priority vip-replace-overlay-priority)) 
-  (if (vip-window-display-p)
+  (if (vip-has-face-support-p)
       (vip-overlay-put vip-replace-overlay 'face vip-replace-overlay-face))
   (vip-save-cursor-color)
   (vip-change-cursor-color vip-replace-overlay-cursor-color)
@@ -579,11 +590,11 @@
 (defsubst vip-hide-replace-overlay ()
   (vip-set-replace-overlay-glyphs nil nil)
   (vip-restore-cursor-color)
-  (if (vip-window-display-p)
+  (if (vip-has-face-support-p)
       (vip-overlay-put vip-replace-overlay 'face nil)))
       
 (defsubst vip-set-replace-overlay-glyphs (before-glyph after-glyph)
-  (if (or (not (vip-window-display-p))
+  (if (or (not (vip-has-face-support-p))
 	  vip-use-replace-region-delimiters)
       (let ((before-name (if vip-xemacs-p 'begin-glyph 'before-string))
 	    (after-name (if vip-xemacs-p 'end-glyph 'after-string)))
@@ -605,7 +616,7 @@
 
 (defun vip-set-minibuffer-overlay ()
   (vip-check-minibuffer-overlay)
-  (if (vip-window-display-p)
+  (if (vip-has-face-support-p)
       (progn
 	(vip-overlay-put
 	 vip-minibuffer-overlay 'face vip-minibuffer-current-face)
@@ -636,6 +647,12 @@
 
 
 ;;; XEmacs compatibility
+
+(defun vip-abbreviate-file-name (file)
+  (if vip-emacs-p
+      (abbreviate-file-name file)
+    ;; XEmacs requires addl argument
+    (abbreviate-file-name file t)))
     
 ;; Sit for VAL milliseconds. XEmacs doesn't support the millisecond arg 
 ;; in sit-for, so this function smoothes out the differences.
--- a/lisp/emulation/viper.el	Fri Feb 16 04:49:12 1996 +0000
+++ b/lisp/emulation/viper.el	Fri Feb 16 05:25:08 1996 +0000
@@ -4694,7 +4694,7 @@
 	        (text-marker (get-register reg)))
 	   (if com (vip-move-marker-locally 'vip-com-point (point)))
 	   (if (not (vip-valid-marker text-marker))
-	       (error (format vip-EmptyTextmarker char)))
+	       (error vip-EmptyTextmarker char))
 	   (if (and (vip-same-line (point) vip-last-jump)
 		    (= (point) vip-last-jump-ignore))
 	       (push-mark vip-last-jump t)