diff options
author | Richard M. Stallman <rms@gnu.org> | 1995-08-14 16:05:12 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1995-08-14 16:05:12 +0000 |
commit | ca180e5d7da977c01a1e6b9a39a8d82e589cac55 (patch) | |
tree | caf6c0c820f5d10789d881965519616eac38d73f | |
parent | f11db4bf7845fd13b70919e9acb8e1654f408560 (diff) | |
download | emacs-ca180e5d7da977c01a1e6b9a39a8d82e589cac55.tar.gz |
(command-line-1): Add option --eval to evalute an
expression on the command line and print the result.
-rw-r--r-- | lisp/startup.el | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/startup.el b/lisp/startup.el index 42a3a5c576f..b482aa880de 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -101,6 +101,9 @@ ;; --funcall FUNC and should not be used. (It's a typo ;; -e FUNC promoted to a feature.) ;; +;; -eval FORM Execute Emacs lisp form FORM, and print +;; --eval FORM the value it returns. +;; ;; -insert FILE Insert the contents of FILE into buffer. ;; --insert FILE ;; ------------------------- @@ -674,7 +677,7 @@ Type \\[describe-distribution] for information on getting the latest version.")) ;; and long versions of what's on command-switch-alist. (longopts (append '(("--funcall") ("--load") ("--insert") ("--kill") - ("--directory")) + ("--directory") ("--eval")) (mapcar '(lambda (elt) (list (concat "-" (car elt)))) command-switch-alist))) @@ -717,6 +720,12 @@ Type \\[describe-distribution] for information on getting the latest version.")) (if (arrayp (symbol-function tem)) (command-execute tem) (funcall tem))) + ((string-equal argi "-eval") + (if argval + (setq tem argval) + (setq tem (car command-line-args-left)) + (setq command-line-args-left (cdr command-line-args-left))) + (print (eval (read tem)))) ;; Set the default directory as specified in -L. ((or (string-equal argi "-L") (string-equal argi "-directory")) |