diff lisp/emulation/viper-ex.el @ 38514:10482dd382e7

* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy of Scott Bronson. (ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions. (viper-check-sub,viper-get-ex-command,viper-execute-ex-command): Deleted functions. (viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new ex-token-list. (viper-get-ex-address-subr): convert registers to char data type. * viper-util.el (viper-int-to-char,viper-char-equal): new functions. (viper-memq-char): use viper-int-to-char. (viper-file-checked-in-p): use vc-locking-user, if vc doesn't have vc-locking-state. (viper-read-key): use viper-read-key-sequence. * viper.el (viper-major-mode-modifier-list): added inferior-emacs-lisp-mode. (this-major-mode-requires-vi-state): new function that uses simple heuristics to decide if vi state is appropriate. (set-viper-state-in-major-mode): use this-major-mode-requires-vi-state. (viper-non-hook-settings): don't advise read-key-sequence. (viper-read-key-sequence): new function that replaces the previously used advice to read-key-sequence. * viper-cmd.el (viper-test-com-defun,viper-exec-change, viper-exec-Change,viper-execute-com,viper-insert,viper-append, viper-Append,viper-Insert,viper-open-line,viper-Open-line, viper-open-line-at-point,viper-substitute,viper-overwrite, viper-replace-char-subr,viper-forward-word,viper-forward-Word): got rid of the negative character hack. (viper-escape-to-state,viper-replace-state-exit-cmd): use viper-read-key-sequence. (viper-envelop-ESC-key): no need for ad-get-orig-definition. (viper-minibuffer-standard-hook,viper-read-string-with-history): don't override existing minibuffer-setup-hook. (viper-mark-point,viper-goto-mark-subr,viper-brac-function): convert registers to char data type. (viper-autoindent): use viper-indent-line. * viper-keym.el: use viper-exec-key-in-emacs. * viper.texi: Added credits, new commands, like :make. * ediff-util.el: Copyright years. (ediff-choose-syntax-table): New function. (ediff-setup): Use ediff-choose-syntax-table. (ediff-file-checked-out-p,ediff-file-checked-in-p): check if vc-state is available. (ediff-make-temp-file): use ediff-coding-system-for-write. * ediff-init.el (ediff-with-syntax-table): New macro, uses with-syntax-table. (ediff-coding-system-for-read): from ediff-diff.el (ediff-coding-system-for-write): new variable. (ediff-highest-priority): fixed the bug having to do with disappearing overlays. (ediff-file-remote-p): use file-remote-p, if available. (ediff-listable-file): new function. (ediff-file-attributes): use ediff-listable-file. * ediff-mult.el (ediff-meta-insert-file-info1): use ediff-listable-file. * ediff-ptch.el (ediff-prompt-for-patch-file): use ediff-coding-system-for-read. (ediff-patch-file-internal): use ediff-coding-system-for-write. * ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el. (ediff-match-diff3-line,ediff-get-diff3-group): improved pattern. * ediff.el: Date of last update, copyright years. * ediff-wind (ediff-setup-control-frame): Nill->nil. * ediff.texi: added clarifications, acknowledgements.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Sat, 21 Jul 2001 05:28:24 +0000
parents 67b464da13ec
children 8dccf2552307
line wrap: on
line diff
--- a/lisp/emulation/viper-ex.el	Fri Jul 20 22:46:18 2001 +0000
+++ b/lisp/emulation/viper-ex.el	Sat Jul 21 05:28:24 2001 +0000
@@ -122,6 +122,7 @@
 	("k"			(ex-mark) one-letter)
 	("kmark"		(ex-mark))
 	("m"			"move")
+	("make"     	    	(ex-compile))
 	; old viper doesn't specify a default for "ma" so leave it undefined
 	("map"			(ex-map))
 	("mark"			(ex-mark))
@@ -215,7 +216,7 @@
 ;; If there is no appropriate key (no match or duplicate matches) return nil
 (defun ex-cmd-assoc (key list)
   (let ((entry (try-completion key list))
-	result onelet)
+	result)
     (setq result (cond
 		  ((eq entry t)     (assoc key list))
 		  ((stringp entry)  (or (ex-splice-args-in-1-letr-cmd key list)
@@ -320,6 +321,11 @@
   :type '(choice (const nil) string)
   :group 'viper-ex)
 
+(defcustom ex-compile-command "make"
+  "The comand to run when the user types :make."
+  :type 'string
+  :group 'viper-ex)
+
 (defcustom viper-glob-function
   (cond (ex-unix-type-shell 'viper-glob-unix-files)
 	((eq system-type 'emx) 'viper-glob-mswindows-files) ; OS/2
@@ -643,7 +649,7 @@
 		      'viper-ex-history
 		      ;; no default when working on region
 		      (if initial-str
-			  "none"
+			  nil
 			(car viper-ex-history))
 		      map
 		      (if initial-str
@@ -855,8 +861,9 @@
 	   (save-excursion
 	     (if (null ex-token)
 		 (exchange-point-and-mark)
-	       (goto-char (viper-register-to-point
-			   (1+ (- ex-token ?a)) 'enforce-buffer)))
+	       (goto-char 
+		(viper-register-to-point
+		 (viper-int-to-char (1+ (- ex-token ?a))) 'enforce-buffer)))
 	     (setq address (point-marker)))))
     address))
 
@@ -1454,7 +1461,7 @@
 	(error "`%s' requires a following letter" ex-token))))
     (save-excursion
       (goto-char (car ex-addresses))
-      (point-to-register (1+ (- char ?a))))))
+      (point-to-register (viper-int-to-char (1+ (- char ?a)))))))
 
     
       
@@ -2159,6 +2166,29 @@
 	  (shell-command-on-region (point) (mark t) command t))
 	(goto-char beg)))))
 
+(defun ex-compile ()
+  "Reads args from the command line, then runs make with the args.
+If no args are given, then it runs the last compile command.
+Type 'mak ' (including the space) to run make with no args."
+  (let (args)
+    (save-window-excursion
+      (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
+      (set-buffer viper-ex-work-buf)
+      (setq args (buffer-substring (point) (point-max)))
+      (end-of-line))
+    ;; Remove the newline that may (will?) be at the end of the args
+    (if (string= "\n" (substring args (1- (length args))))
+	(setq args (substring args 0 (1- (length args)))))
+    ;; Run last command if no args given, else construct a new command.
+    (setq args
+	  (if (string= "" args)
+	      (if (boundp 'compile-command)
+		  compile-command
+		ex-compile-command)
+	    (concat ex-compile-command " " args)))
+    (compile args)
+    ))
+
 ;; Print line number
 (defun ex-line-no ()
   (message "%d"