diff options
| author | John Wiegley | 2001-04-24 01:37:31 +0000 |
|---|---|---|
| committer | John Wiegley | 2001-04-24 01:37:31 +0000 |
| commit | 9c6a6a5a66a535115fae4b861cfdbabef0ea507d (patch) | |
| tree | 081c231101da7051d347114336cf25fe90d79778 /lisp/eshell | |
| parent | 671faf58749763bd3d6b189467b0706e54ce1065 (diff) | |
| download | emacs-9c6a6a5a66a535115fae4b861cfdbabef0ea507d.tar.gz emacs-9c6a6a5a66a535115fae4b861cfdbabef0ea507d.zip | |
(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.el | 11 |
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)." | |||
| 328 | (define-key eshell-mode-map [(meta return)] 'exit-minibuffer) | 328 | (define-key eshell-mode-map [(meta return)] 'exit-minibuffer) |
| 329 | (define-key eshell-mode-map [(meta control ?m)] 'exit-minibuffer)) | 329 | (define-key eshell-mode-map [(meta control ?m)] 'exit-minibuffer)) |
| 330 | 330 | ||
| 331 | (defvar eshell-non-interactive-p nil | ||
| 332 | "A variable which is non-nil when Eshell is not running interactively. | ||
| 333 | Modules should use this variable so that they don't clutter | ||
| 334 | non-interactive sessions, such as when using `eshell-command'.") | ||
| 335 | |||
| 331 | ;;;###autoload | 336 | ;;;###autoload |
| 332 | (defun eshell-command (&optional command arg) | 337 | (defun eshell-command (&optional command arg) |
| 333 | "Execute the Eshell command string COMMAND. | 338 | "Execute the Eshell command string COMMAND. |
| 334 | With prefix ARG, insert output into the current buffer at point." | 339 | With prefix ARG, insert output into the current buffer at point." |
| 335 | (interactive) | 340 | (interactive) |
| 336 | (require 'esh-cmd) | 341 | (require 'esh-cmd) |
| 337 | (setq arg current-prefix-arg) | 342 | (unless arg |
| 343 | (setq arg current-prefix-arg)) | ||
| 338 | (unwind-protect | 344 | (unwind-protect |
| 339 | (let ((eshell-non-interactive-p t)) | 345 | (let ((eshell-non-interactive-p t)) |
| 340 | (add-hook 'minibuffer-setup-hook 'eshell-mode) | 346 | (add-hook 'minibuffer-setup-hook 'eshell-mode) |
| 341 | (add-hook 'eshell-mode-hook 'eshell-return-exits-minibuffer) | 347 | (add-hook 'eshell-mode-hook 'eshell-return-exits-minibuffer) |
| 342 | (setq command (read-from-minibuffer "Emacs shell command: "))) | 348 | (unless command |
| 349 | (setq command (read-from-minibuffer "Emacs shell command: ")))) | ||
| 343 | (remove-hook 'eshell-mode-hook 'eshell-return-exits-minibuffer) | 350 | (remove-hook 'eshell-mode-hook 'eshell-return-exits-minibuffer) |
| 344 | (remove-hook 'minibuffer-setup-hook 'eshell-mode)) | 351 | (remove-hook 'minibuffer-setup-hook 'eshell-mode)) |
| 345 | (unless command | 352 | (unless command |