summaryrefslogtreecommitdiff
path: root/lisp/eshell
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2001-04-24 01:37:31 +0000
committerJohn Wiegley <johnw@newartisans.com>2001-04-24 01:37:31 +0000
commit9c6a6a5a66a535115fae4b861cfdbabef0ea507d (patch)
tree081c231101da7051d347114336cf25fe90d79778 /lisp/eshell
parent671faf58749763bd3d6b189467b0706e54ce1065 (diff)
downloademacs-9c6a6a5a66a535115fae4b861cfdbabef0ea507d.tar.gz
(eshell-command): Made a few changes so that `eshell-command' could be
called programmatically. (eshell-non-interactive-p): Moved this variable here.
Diffstat (limited to 'lisp/eshell')
-rw-r--r--lisp/eshell/eshell.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
index 4f682b5a314..8e30d5de48d 100644
--- a/lisp/eshell/eshell.el
+++ b/lisp/eshell/eshell.el
@@ -328,18 +328,25 @@ argument ARG is specified. Returns the buffer selected (or created)."
(define-key eshell-mode-map [(meta return)] 'exit-minibuffer)
(define-key eshell-mode-map [(meta control ?m)] 'exit-minibuffer))
+(defvar eshell-non-interactive-p nil
+ "A variable which is non-nil when Eshell is not running interactively.
+Modules should use this variable so that they don't clutter
+non-interactive sessions, such as when using `eshell-command'.")
+
;;;###autoload
(defun eshell-command (&optional command arg)
"Execute the Eshell command string COMMAND.
With prefix ARG, insert output into the current buffer at point."
(interactive)
(require 'esh-cmd)
- (setq arg current-prefix-arg)
+ (unless arg
+ (setq arg current-prefix-arg))
(unwind-protect
(let ((eshell-non-interactive-p t))
(add-hook 'minibuffer-setup-hook 'eshell-mode)
(add-hook 'eshell-mode-hook 'eshell-return-exits-minibuffer)
- (setq command (read-from-minibuffer "Emacs shell command: ")))
+ (unless command
+ (setq command (read-from-minibuffer "Emacs shell command: "))))
(remove-hook 'eshell-mode-hook 'eshell-return-exits-minibuffer)
(remove-hook 'minibuffer-setup-hook 'eshell-mode))
(unless command