changeset 14580:1883960762e0

*** empty log message ***
author Michael Kifer <kifer@cs.stonybrook.edu>
date Fri, 16 Feb 1996 04:49:12 +0000
parents a81dd4e9603a
children 4951b11970a1
files lisp/emulation/viper-ex.el lisp/emulation/viper-macs.el lisp/emulation/viper.el
diffstat 3 files changed, 46 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emulation/viper-ex.el	Fri Feb 16 04:27:19 1996 +0000
+++ b/lisp/emulation/viper-ex.el	Fri Feb 16 04:49:12 1996 +0000
@@ -489,7 +489,7 @@
 		      ))
 		   ))
 	    ((eq ex-token-type 'non-command)
-	     (error "`%s': %s" ex-token vip-BadExCommand))
+	     (error (format "`%s': %s" ex-token vip-BadExCommand)))
 	    ((eq ex-token-type 'whole)
 	     (setq address nil)
 	     (setq ex-addresses
@@ -839,9 +839,23 @@
   (setq vip-keep-reading-filename t) 
   ;; don't exit if directory---ex-commands don't 
   (cond ((ex-cmd-accepts-multiple-files-p ex-token) (exit-minibuffer))
-	(t (minibuffer-complete-word))))
-     
-	       
+	;; apparently the argument to an Ex command is
+	;; supposed to be a shell command
+	((vip-looking-back "^[ \t]*!.*")
+	 (setq ex-cmdfile t)
+	 (insert " "))
+	(t
+	 (setq ex-cmdfile nil)
+	 (minibuffer-complete-word))))
+
+(defun vip-handle-! ()
+  (interactive)
+  (if (and (string=
+	    (buffer-string) (vip-abbreviate-file-name default-directory))
+	   (member ex-token '("read" "write")))
+      (erase-buffer))
+  (insert "!"))
+
 (defun ex-cmd-accepts-multiple-files-p (token)
   (member token '("edit" "next" "Next")))
 
@@ -853,7 +867,10 @@
 	  (copy-keymap minibuffer-local-completion-map))
 	 beg end cont val)
     
-    (vip-add-keymap ex-read-filename-map minibuffer-local-completion-map) 
+    (vip-add-keymap ex-read-filename-map
+		    (if vip-emacs-p 
+			minibuffer-local-completion-map
+		      read-file-name-map)) 
 		    
     (setq cont (setq vip-keep-reading-filename t))
     (while cont
@@ -944,19 +961,22 @@
 	     (string= ex-token "change")
 	     (string= ex-token "insert")
 	     (string= ex-token "open"))
-	 (error "`%s': Obsolete command, not supported by Viper"
-		ex-token))
+	 (error
+	  (format "`%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))
+	   ex-token)))
 	((or (string= ex-token "list")
 	     (string= ex-token "print")
 	     (string= ex-token "z")
 	     (string= ex-token "#"))
-	 (error "`%s': Command not implemented in Viper" ex-token))
-	(t (error "`%s': %s" ex-token vip-BadExCommand))))
+	 (error
+	  (format "`%s': Command not implemented in Viper" ex-token)))
+	(t (error (format "`%s': %s" ex-token vip-BadExCommand)))))
 
 (defun vip-undisplayed-files ()
   (mapcar
@@ -1081,7 +1101,7 @@
   (if (not file)
       (vip-get-ex-file))
   (cond ((and (string= ex-file "") buffer-file-name)
-	 (setq ex-file  (abbreviate-file-name (buffer-file-name))))
+	 (setq ex-file  (vip-abbreviate-file-name (buffer-file-name))))
 	((string= ex-file "")
 	 (error vip-NoFileSpecified)))
       
@@ -1361,7 +1381,8 @@
     (if (not (vip-buffer-live-p buf))
 	(error "Didn't find buffer %S or file %S"
 	       file-or-buffer-name
-	       (abbreviate-file-name (expand-file-name file-or-buffer-name))))
+	       (vip-abbreviate-file-name
+		(expand-file-name file-or-buffer-name))))
 	  
     (if (equal buf (current-buffer))
 	(or no-recursion
@@ -1425,7 +1446,8 @@
 ;; Ex read command
 (defun ex-read ()
   (vip-get-ex-file)
-  (let ((point (if (null ex-addresses) (point) (car ex-addresses))))
+  (let ((point (if (null ex-addresses) (point) (car ex-addresses)))
+	command)
     (goto-char point)
     (vip-add-newline-at-eob-if-necessary)
     (if (not (or (bobp) (eobp))) (forward-line 1))
@@ -1435,7 +1457,9 @@
 	      (error vip-NoFileSpecified))
 	  (setq ex-file buffer-file-name)))
     (if ex-cmdfile
-	(shell-command ex-file t)
+	(progn
+	  (setq command (ex-expand-filsyms ex-file (current-buffer)))
+	  (shell-command command t))
       (insert-file-contents ex-file)))
   (ex-fixup-history vip-last-ex-prompt ex-file))
   
@@ -1675,7 +1699,7 @@
   (condition-case nil
       (progn
 	(pop-to-buffer (get-buffer-create "*info*"))
-	(info "viper.info")
+	(info (if vip-xemacs-p "viper.info" "viper"))
 	(message "Type `i' to search for a specific topic"))
     (error (beep 1)
 	   (with-output-to-temp-buffer " *vip-info*"
@@ -1875,7 +1899,7 @@
 
 (defun ex-write-info (exists file-name beg end)
   (message "`%s'%s %d lines, %d characters"
-	   (abbreviate-file-name file-name)
+	   (vip-abbreviate-file-name file-name)
 	   (if exists "" " [New file]")
 	   (count-lines beg (min (1+ end) (point-max)))
 	   (- end beg)))
@@ -1947,7 +1971,7 @@
 	lines file info)
     (setq lines (count-lines (point-min) (vip-line-pos 'end))
 	  file (if (buffer-file-name)
-		   (concat (abbreviate-file-name (buffer-file-name)) ":")
+		   (concat (vip-abbreviate-file-name (buffer-file-name)) ":")
 		 (concat (buffer-name) " [Not visiting any file]:"))
 	  info (format "line=%d/%d pos=%d/%d col=%d %s"
 		       (if (= pos1 pos2)
--- a/lisp/emulation/viper-macs.el	Fri Feb 16 04:27:19 1996 +0000
+++ b/lisp/emulation/viper-macs.el	Fri Feb 16 04:49:12 1996 +0000
@@ -391,8 +391,9 @@
 			  (if (stringp macro-body) "  ....\"" "  ....]"))
 			 state-name))
 		  t)))
-	  (if (y-or-n-p (format "Save this macro in %s? "
-				(abbreviate-file-name vip-custom-file-name)))
+	  (if (y-or-n-p
+	       (format "Save this macro in %s? "
+		       (vip-abbreviate-file-name vip-custom-file-name)))
 	      (vip-save-string-in-file 
 	       (format "\n(vip-record-kbd-macro %S '%S %s '%S)"
 		       (vip-display-macro macro-name)
@@ -903,7 +904,7 @@
 	       (setq vip-last-macro-reg reg)
 	       (vip-set-register-macro reg))))
 	  (t
-	   (error "`%c': Unknown register" reg)))))
+	   (error (format "`%c': Unknown register" reg))))))
 	   
 
 (defun vip-global-execute ()
--- a/lisp/emulation/viper.el	Fri Feb 16 04:27:19 1996 +0000
+++ b/lisp/emulation/viper.el	Fri Feb 16 04:49:12 1996 +0000
@@ -4839,8 +4839,7 @@
 	  ((vip-valid-register reg '(letter))
 	   (let* ((val (get-register (1+ (- reg ?a))))
 		  (buf (if (not val) 
-			   (error 
-			    (format vip-EmptyTextmarker reg))
+			   (error vip-EmptyTextmarker reg)
 			 (marker-buffer val)))
 		  (pos (marker-position val))
 		  line-no text (s pos) (e pos))