Function: eshell-compile
eshell-compile is a byte-compiled function defined in em-unix.el.gz.
Signature
(eshell-compile COMMAND ARGS &optional METHOD MODE)
Documentation
Run an external COMMAND with ARGS using a compilation buffer when possible.
COMMAND should be a list of command-line arguments. By default, if the command is outputting to the screen and is not part of a pipeline or subcommand, open an compilation buffer to hold the results; otherwise, write the output on stdout.
If METHOD is interactive, always open a compilation buffer. If
METHOD is plain, always write to stdout.
MODE, if specified, is the major mode to set in the compilation
buffer (see compilation-start).
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/em-unix.el.gz
;; special front-end functions for compilation-mode buffers
(defun eshell-compile (command args &optional method mode)
"Run an external COMMAND with ARGS using a compilation buffer when possible.
COMMAND should be a list of command-line arguments. By default,
if the command is outputting to the screen and is not part of a
pipeline or subcommand, open an compilation buffer to hold the
results; otherwise, write the output on stdout.
If METHOD is `interactive', always open a compilation buffer. If
METHOD is `plain', always write to stdout.
MODE, if specified, is the major mode to set in the compilation
buffer (see `compilation-start')."
(if (and (not (eq method 'interactive))
(or (eq method 'plain)
eshell-in-pipeline-p
eshell-in-subcommand-p
(not (eshell-interactive-output-p))))
(throw 'eshell-replace-command
(eshell-parse-command (concat "*" command) args))
(compile
(mapconcat #'shell-quote-argument
(eshell-stringify-list (flatten-tree (cons command args)))
" ")
mode)))