changeset 26195:185120634897

(command-line-1): Add support for `file' and `execute'. Fix handling of `visit'.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 26 Oct 1999 14:35:16 +0000
parents 5643e0243ec7
children 185e372ce5f7
files lisp/startup.el
diffstat 1 files changed, 29 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/startup.el	Tue Oct 26 14:34:42 1999 +0000
+++ b/lisp/startup.el	Tue Oct 26 14:35:16 1999 +0000
@@ -88,6 +88,10 @@
 ;; of these are also found in term/pc-win.el
 ;; -------------------------
 ;; FILE                      Visit FILE.
+;; -visit FILE
+;; --visit FILE
+;; -file FILE
+;; --file FILE
 ;;
 ;; -L DIRNAME                Add DIRNAME to load-path
 ;; -directory DIRNAME
@@ -104,6 +108,8 @@
 ;;
 ;; -eval FORM                Execute Emacs lisp form FORM.
 ;; --eval FORM
+;; -execute EXPR
+;; --execute EXPR
 ;;
 ;; -insert FILE              Insert the contents of FILE into buffer.
 ;; --insert FILE
@@ -956,7 +962,8 @@
 	  ;; and long versions of what's on command-switch-alist.
 	  (longopts
 	   (append '(("--funcall") ("--load") ("--insert") ("--kill")
-		     ("--directory") ("--eval") ("--find-file") ("--visit"))
+		     ("--directory") ("--eval") ("--execute")
+		     ("--find-file") ("--visit") ("--file"))
 		   (mapcar '(lambda (elt)
 			      (list (concat "-" (car elt))))
 			   command-switch-alist)))
@@ -1008,6 +1015,7 @@
 			    (cons argval command-line-args-left)))
 		       (funcall (cdr tem) argi))
 		   (funcall (cdr tem) argi)))
+		
 		((or (string-equal argi "-f")  ;what the manual claims
 		     (string-equal argi "-funcall")
 		     (string-equal argi "-e")) ; what the source used to say
@@ -1018,13 +1026,16 @@
 		 (if (arrayp (symbol-function tem))
 		     (command-execute tem)
 		   (funcall tem)))
-		((string-equal argi "-eval")
+		
+		((or (string-equal argi "-eval")
+		     (string-equal argi "-execute"))
 		 (if argval
 		     (setq tem argval)
 		   (setq tem (car command-line-args-left))
 		   (setq command-line-args-left (cdr command-line-args-left)))
 		 (eval (read tem)))
 		;; Set the default directory as specified in -L.
+		
 		((or (string-equal argi "-L")
 		     (string-equal argi "-directory"))
 		 (if argval
@@ -1036,6 +1047,7 @@
 		       (cons (expand-file-name tem) extra-load-path))
 		 (setq load-path (append (nreverse extra-load-path)
 					 initial-load-path)))
+		
 		((or (string-equal argi "-l")
 		     (string-equal argi "-load"))
 		 (if argval
@@ -1048,6 +1060,7 @@
 		   (if (file-exists-p (expand-file-name file))
 		       (setq file (expand-file-name file)))
 		   (load file nil t)))
+		
 		((string-equal argi "-insert")
 		 (if argval
 		     (setq tem argval)
@@ -1056,28 +1069,38 @@
 		 (or (stringp tem)
 		     (error "File name omitted from `-insert' option"))
 		 (insert-file-contents (command-line-normalize-file-name tem)))
+		
 		((string-equal argi "-kill")
 		 (kill-emacs t))
+		
 		((string-match "^\\+[0-9]+\\'" argi)
 		 (setq line (string-to-int argi)))
+		
 		((setq tem (assoc argi command-line-x-option-alist))
 		 ;; Ignore X-windows options and their args if not using X.
 		 (setq command-line-args-left
 		       (nthcdr (nth 1 tem) command-line-args-left)))
+		
 		((or (string-equal argi "-find-file")
+		     (string-equal argi "-file")
 		     (string-equal argi "-visit"))
 		 ;; An explicit option to specify visiting a file.
+		 (if argval
+		     (setq tem argval)
+		   (setq tem (car command-line-args-left)
+			 command-line-args-left (cdr command-line-args-left)))
+		 (unless (stringp tem)
+		   (error "File name omitted from `%s' option" argi))
 		 (setq file-count (1+ file-count))
-		 (let ((file
-			(expand-file-name
-			 (command-line-normalize-file-name orig-argi)
-			 dir)))
+		 (let ((file (expand-file-name
+			      (command-line-normalize-file-name tem) dir)))
 		   (if (= file-count 1)
 		       (setq first-file-buffer (find-file file))
 		     (find-file-other-window file)))
 		 (or (zerop line)
 		     (goto-line line))
 		 (setq line 0))
+		
 		((equal argi "--")
 		 (setq just-files t))
 		(t