2013-09-12 16:15:53 -04:00
|
|
|
;;; esh-io.el --- I/O management -*- lexical-binding:t -*-
|
2000-06-23 05:24:10 +00:00
|
|
|
|
2022-01-01 02:45:51 -05:00
|
|
|
;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
|
2000-06-23 05:24:10 +00:00
|
|
|
|
2000-10-16 12:27:09 +00:00
|
|
|
;; Author: John Wiegley <johnw@gnu.org>
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 03:36:21 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2000-06-23 05:24:10 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 03:36:21 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 15:52:52 -07:00
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; At the moment, only output redirection is supported in Eshell. To
|
|
|
|
;; use input redirection, the following syntax will work, assuming
|
|
|
|
;; that the command after the pipe is always an external command:
|
|
|
|
;;
|
|
|
|
;; cat <file> | <command>
|
|
|
|
;;
|
|
|
|
;; Otherwise, output redirection and piping are provided in a manner
|
|
|
|
;; consistent with most shells. Therefore, only unique features are
|
|
|
|
;; mentioned here.
|
|
|
|
;;
|
2015-05-15 19:42:00 -07:00
|
|
|
;;;_* Redirect to a Buffer or Process
|
|
|
|
;;
|
|
|
|
;; Buffers and processes can be named with '#<buffer buffer-name>' and
|
2021-09-14 07:55:56 +02:00
|
|
|
;; '#<process process-name>', respectively. As a shorthand,
|
2015-05-15 19:42:00 -07:00
|
|
|
;; '#<buffer-name>' without the explicit "buffer" arg is equivalent to
|
|
|
|
;; '#<buffer buffer-name>'.
|
|
|
|
;;
|
|
|
|
;; echo hello > #<buffer *scratch*> # Overwrite '*scratch*' with 'hello'.
|
|
|
|
;; echo hello > #<*scratch*> # Same as the command above.
|
|
|
|
;;
|
|
|
|
;; echo hello > #<process shell> # Pipe "hello" into the shell process.
|
|
|
|
;;
|
2000-06-23 05:24:10 +00:00
|
|
|
;;;_* Insertion
|
|
|
|
;;
|
|
|
|
;; To insert at the location of point in a buffer, use '>>>':
|
|
|
|
;;
|
|
|
|
;; echo alpha >>> #<buffer *scratch*>;
|
|
|
|
;;
|
|
|
|
;;;_* Pseudo-devices
|
|
|
|
;;
|
|
|
|
;; A few pseudo-devices are provided, since Emacs cannot write
|
|
|
|
;; directly to a UNIX device file:
|
|
|
|
;;
|
|
|
|
;; echo alpha > /dev/null ; the bit bucket
|
|
|
|
;; echo alpha > /dev/kill ; set the kill ring
|
|
|
|
;; echo alpha >> /dev/clip ; append to the clipboard
|
|
|
|
;;
|
|
|
|
;;;_* Multiple output targets
|
|
|
|
;;
|
|
|
|
;; Eshell can write to multiple output targets, including pipes.
|
|
|
|
;; Example:
|
|
|
|
;;
|
|
|
|
;; (+ 1 2) > a > b > c ; prints number to all three files
|
|
|
|
;; (+ 1 2) > a | wc ; prints to 'a', and pipes to 'wc'
|
|
|
|
|
2009-01-22 06:33:06 +00:00
|
|
|
;;; Code:
|
|
|
|
|
Silence many eshell compilation warnings
* lisp/eshell/em-tramp.el: Adjust requires.
(eshell-parse-command): Autoload.
* lisp/eshell/em-xtra.el: Adjust requires.
(eshell-parse-command): Autoload.
* lisp/eshell/esh-ext.el: Adjust requires.
(eshell-parse-command, eshell-close-handles): Autoload.
* lisp/eshell/esh-io.el: Adjust requires.
(eshell-output-filter): Autoload.
* lisp/eshell/esh-util.el: No need to load tramp when compiling.
(tramp-file-name-structure, ange-ftp-ls, ange-ftp-file-modtime): Declare.
(eshell-parse-ange-ls): Require ange-ftp and tramp.
* lisp/eshell/em-alias.el, lisp/eshell/em-banner.el, lisp/eshell/em-basic.el:
* lisp/eshell/em-cmpl.el, lisp/eshell/em-glob.el, lisp/eshell/em-pred.el:
* lisp/eshell/em-prompt.el, lisp/eshell/em-rebind.el, lisp/eshell/em-smart.el:
* lisp/eshell/em-term.el, lisp/eshell/esh-arg.el, lisp/eshell/esh-mode.el:
* lisp/eshell/esh-opt.el, lisp/eshell/esh-proc.el:
* lisp/eshell/esh-var.el: Adjust requires.
* lisp/eshell/eshell.el: Do not require esh-util twice.
(eshell-add-input-to-history): Declare.
(eshell-command): Check history module is active before using it.
2013-05-22 21:57:27 -07:00
|
|
|
(require 'esh-arg)
|
|
|
|
(require 'esh-util)
|
|
|
|
|
2008-10-08 07:42:58 +00:00
|
|
|
(eval-when-compile
|
Silence many eshell compilation warnings
* lisp/eshell/em-tramp.el: Adjust requires.
(eshell-parse-command): Autoload.
* lisp/eshell/em-xtra.el: Adjust requires.
(eshell-parse-command): Autoload.
* lisp/eshell/esh-ext.el: Adjust requires.
(eshell-parse-command, eshell-close-handles): Autoload.
* lisp/eshell/esh-io.el: Adjust requires.
(eshell-output-filter): Autoload.
* lisp/eshell/esh-util.el: No need to load tramp when compiling.
(tramp-file-name-structure, ange-ftp-ls, ange-ftp-file-modtime): Declare.
(eshell-parse-ange-ls): Require ange-ftp and tramp.
* lisp/eshell/em-alias.el, lisp/eshell/em-banner.el, lisp/eshell/em-basic.el:
* lisp/eshell/em-cmpl.el, lisp/eshell/em-glob.el, lisp/eshell/em-pred.el:
* lisp/eshell/em-prompt.el, lisp/eshell/em-rebind.el, lisp/eshell/em-smart.el:
* lisp/eshell/em-term.el, lisp/eshell/esh-arg.el, lisp/eshell/esh-mode.el:
* lisp/eshell/esh-opt.el, lisp/eshell/esh-proc.el:
* lisp/eshell/esh-var.el: Adjust requires.
* lisp/eshell/eshell.el: Do not require esh-util twice.
(eshell-add-input-to-history): Declare.
(eshell-command): Check history module is active before using it.
2013-05-22 21:57:27 -07:00
|
|
|
(require 'cl-lib))
|
2007-12-05 07:06:02 +00:00
|
|
|
|
|
|
|
(defgroup eshell-io nil
|
|
|
|
"Eshell's I/O management code provides a scheme for treating many
|
|
|
|
different kinds of objects -- symbols, files, buffers, etc. -- as
|
|
|
|
though they were files."
|
|
|
|
:tag "I/O management"
|
|
|
|
:group 'eshell)
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
;;; User Variables:
|
|
|
|
|
2011-03-04 20:11:05 -08:00
|
|
|
(defcustom eshell-io-load-hook nil
|
Cosmetic doc fixes for eshell.
* eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
* eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
* eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
* eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
* eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
* eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el:
* eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el:
* eshell/esh-util.el, eshell/esh-var.el:
Remove leading `*' from docs of faces and defcustoms.
2010-09-25 14:51:55 -07:00
|
|
|
"A hook that gets run when `eshell-io' is loaded."
|
2011-03-04 20:11:05 -08:00
|
|
|
:version "24.1" ; removed eshell-io-initialize
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'hook
|
|
|
|
:group 'eshell-io)
|
|
|
|
|
|
|
|
(defcustom eshell-number-of-handles 3
|
Cosmetic doc fixes for eshell.
* eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
* eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
* eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
* eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
* eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
* eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el:
* eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el:
* eshell/esh-util.el, eshell/esh-var.el:
Remove leading `*' from docs of faces and defcustoms.
2010-09-25 14:51:55 -07:00
|
|
|
"The number of file handles that eshell supports.
|
2000-06-23 05:24:10 +00:00
|
|
|
Currently this is standard input, output and error. But even all of
|
|
|
|
these Emacs does not currently support with asynchronous processes
|
|
|
|
\(which is what eshell uses so that you can continue doing work in
|
2021-09-14 08:43:18 +02:00
|
|
|
other buffers)."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'integer
|
|
|
|
:group 'eshell-io)
|
|
|
|
|
|
|
|
(defcustom eshell-output-handle 1
|
Cosmetic doc fixes for eshell.
* eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
* eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
* eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
* eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
* eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
* eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el:
* eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el:
* eshell/esh-util.el, eshell/esh-var.el:
Remove leading `*' from docs of faces and defcustoms.
2010-09-25 14:51:55 -07:00
|
|
|
"The index of the standard output handle."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'integer
|
|
|
|
:group 'eshell-io)
|
|
|
|
|
|
|
|
(defcustom eshell-error-handle 2
|
Cosmetic doc fixes for eshell.
* eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
* eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
* eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
* eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
* eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
* eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el:
* eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el:
* eshell/esh-util.el, eshell/esh-var.el:
Remove leading `*' from docs of faces and defcustoms.
2010-09-25 14:51:55 -07:00
|
|
|
"The index of the standard error handle."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'integer
|
|
|
|
:group 'eshell-io)
|
|
|
|
|
|
|
|
(defcustom eshell-print-queue-size 5
|
Cosmetic doc fixes for eshell.
* eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
* eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
* eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
* eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
* eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
* eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el:
* eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el:
* eshell/esh-util.el, eshell/esh-var.el:
Remove leading `*' from docs of faces and defcustoms.
2010-09-25 14:51:55 -07:00
|
|
|
"The size of the print queue, for doing buffered printing.
|
2000-06-23 05:24:10 +00:00
|
|
|
This is basically a speed enhancement, to avoid blocking the Lisp code
|
|
|
|
from executing while Emacs is redisplaying."
|
|
|
|
:type 'integer
|
|
|
|
:group 'eshell-io)
|
|
|
|
|
|
|
|
(defcustom eshell-virtual-targets
|
|
|
|
'(("/dev/eshell" eshell-interactive-print nil)
|
|
|
|
("/dev/kill" (lambda (mode)
|
|
|
|
(if (eq mode 'overwrite)
|
|
|
|
(kill-new ""))
|
|
|
|
'eshell-kill-append) t)
|
|
|
|
("/dev/clip" (lambda (mode)
|
|
|
|
(if (eq mode 'overwrite)
|
2016-12-10 18:11:56 -08:00
|
|
|
(let ((select-enable-clipboard t))
|
2000-06-23 05:24:10 +00:00
|
|
|
(kill-new "")))
|
|
|
|
'eshell-clipboard-append) t))
|
Cosmetic doc fixes for eshell.
* eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
* eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
* eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
* eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
* eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
* eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el:
* eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el:
* eshell/esh-util.el, eshell/esh-var.el:
Remove leading `*' from docs of faces and defcustoms.
2010-09-25 14:51:55 -07:00
|
|
|
"Map virtual devices name to Emacs Lisp functions.
|
2000-06-23 05:24:10 +00:00
|
|
|
If the user specifies any of the filenames above as a redirection
|
|
|
|
target, the function in the second element will be called.
|
|
|
|
|
|
|
|
If the third element is non-nil, the redirection mode is passed as an
|
|
|
|
argument (which is the symbol `overwrite', `append' or `insert'), and
|
|
|
|
the function is expected to return another function -- which is the
|
|
|
|
output function. Otherwise, the second element itself is the output
|
|
|
|
function.
|
|
|
|
|
2000-08-29 00:47:45 +00:00
|
|
|
The output function is then called repeatedly with single strings,
|
|
|
|
which represents successive pieces of the output of the command, until nil
|
2000-06-23 05:24:10 +00:00
|
|
|
is passed, meaning EOF.
|
|
|
|
|
|
|
|
NOTE: /dev/null is handled specially as a virtual target, and should
|
|
|
|
not be added to this variable."
|
|
|
|
:type '(repeat
|
|
|
|
(list (string :tag "Target")
|
|
|
|
function
|
|
|
|
(choice (const :tag "Func returns output-func" t)
|
|
|
|
(const :tag "Func is output-func" nil))))
|
2021-12-24 03:24:44 +01:00
|
|
|
:risky t
|
2000-06-23 05:24:10 +00:00
|
|
|
:group 'eshell-io)
|
|
|
|
|
2022-02-01 19:16:00 -08:00
|
|
|
(define-error 'eshell-pipe-broken "Pipe broken")
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
;;; Internal Variables:
|
|
|
|
|
2022-07-09 16:26:55 -07:00
|
|
|
(defconst eshell-redirection-operators-alist
|
|
|
|
'(("<" . input) ; FIXME: Not supported yet.
|
|
|
|
(">" . overwrite)
|
|
|
|
(">>" . append)
|
|
|
|
(">>>" . insert))
|
|
|
|
"An association list of redirection operators to symbols
|
|
|
|
describing the mode, e.g. for using with `eshell-get-target'.")
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
(defvar eshell-current-handles nil)
|
|
|
|
|
|
|
|
(defvar eshell-last-command-status 0
|
|
|
|
"The exit code from the last command. 0 if successful.")
|
|
|
|
|
|
|
|
(defvar eshell-last-command-result nil
|
|
|
|
"The result of the last command. Not related to success.")
|
|
|
|
|
|
|
|
(defvar eshell-output-file-buffer nil
|
|
|
|
"If non-nil, the current buffer is a file output buffer.")
|
|
|
|
|
|
|
|
(defvar eshell-print-count)
|
|
|
|
(defvar eshell-current-redirections)
|
|
|
|
|
|
|
|
;;; Functions:
|
|
|
|
|
2019-04-09 14:57:29 -04:00
|
|
|
(defun eshell-io-initialize () ;Called from `eshell-mode' via intern-soft!
|
2000-06-23 05:24:10 +00:00
|
|
|
"Initialize the I/O subsystem code."
|
|
|
|
(add-hook 'eshell-parse-argument-hook
|
2022-07-09 16:26:55 -07:00
|
|
|
#'eshell-parse-redirection nil t)
|
2000-06-23 05:24:10 +00:00
|
|
|
(make-local-variable 'eshell-current-redirections)
|
|
|
|
(add-hook 'eshell-pre-rewrite-command-hook
|
2022-07-09 16:26:55 -07:00
|
|
|
#'eshell-strip-redirections nil t)
|
2013-09-17 11:19:12 -04:00
|
|
|
(add-function :filter-return (local 'eshell-post-rewrite-command-function)
|
|
|
|
#'eshell--apply-redirections))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
(defun eshell-parse-redirection ()
|
2022-07-09 16:26:55 -07:00
|
|
|
"Parse an output redirection, such as `2>' or `>&'."
|
|
|
|
(when (not eshell-current-quoted)
|
|
|
|
(cond
|
|
|
|
;; Copying a handle (e.g. `2>&1').
|
|
|
|
((looking-at (rx (? (group digit))
|
|
|
|
(group (or "<" ">"))
|
|
|
|
"&" (group digit)
|
|
|
|
(* (syntax whitespace))))
|
|
|
|
(let ((source (string-to-number (or (match-string 1) "1")))
|
|
|
|
(mode (cdr (assoc (match-string 2)
|
|
|
|
eshell-redirection-operators-alist)))
|
|
|
|
(target (string-to-number (match-string 3))))
|
|
|
|
(when (eq mode 'input)
|
|
|
|
(error "Eshell does not support input redirection"))
|
|
|
|
(goto-char (match-end 0))
|
|
|
|
(eshell-finish-arg (list 'eshell-copy-output-handle
|
|
|
|
source target))))
|
|
|
|
;; Shorthand for redirecting both stdout and stderr (e.g. `&>').
|
|
|
|
((looking-at (rx (or (seq (group (** 1 3 ">")) "&")
|
|
|
|
(seq "&" (group-n 1 (** 1 3 ">"))))
|
|
|
|
(* (syntax whitespace))))
|
|
|
|
(if eshell-current-argument
|
|
|
|
(eshell-finish-arg)
|
|
|
|
(goto-char (match-end 0))
|
|
|
|
(eshell-finish-arg
|
|
|
|
(let ((mode (cdr (assoc (match-string 1)
|
|
|
|
eshell-redirection-operators-alist))))
|
|
|
|
(list 'eshell-set-all-output-handles
|
|
|
|
(list 'quote mode))))))
|
|
|
|
;; Shorthand for piping both stdout and stderr (i.e. `|&').
|
|
|
|
((looking-at (rx "|&" (* (syntax whitespace))))
|
|
|
|
(if eshell-current-argument
|
|
|
|
(eshell-finish-arg)
|
|
|
|
(goto-char (match-end 0))
|
|
|
|
(eshell-finish-arg
|
|
|
|
'(eshell-copy-output-handle eshell-error-handle
|
|
|
|
eshell-output-handle)
|
|
|
|
'(eshell-operator "|"))))
|
|
|
|
;; Regular redirecting (e.g. `2>').
|
|
|
|
((looking-at (rx (? (group digit))
|
|
|
|
(group (or "<" (** 1 3 ">")))
|
|
|
|
(* (syntax whitespace))))
|
2000-06-23 05:24:10 +00:00
|
|
|
(if eshell-current-argument
|
2022-07-09 16:26:55 -07:00
|
|
|
(eshell-finish-arg)
|
|
|
|
(let ((source (if (match-string 1)
|
|
|
|
(string-to-number (match-string 1))
|
|
|
|
eshell-output-handle))
|
|
|
|
(mode (cdr (assoc (match-string 2)
|
|
|
|
eshell-redirection-operators-alist))))
|
|
|
|
(when (eq mode 'input)
|
|
|
|
(error "Eshell does not support input redirection"))
|
|
|
|
(goto-char (match-end 0))
|
|
|
|
(eshell-finish-arg
|
|
|
|
;; Note: the target will be set later by
|
|
|
|
;; `eshell-strip-redirections'.
|
|
|
|
(list 'eshell-set-output-handle
|
|
|
|
source (list 'quote mode)))))))))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
(defun eshell-strip-redirections (terms)
|
|
|
|
"Rewrite any output redirections in TERMS."
|
|
|
|
(setq eshell-current-redirections (list t))
|
|
|
|
(let ((tl terms)
|
2022-07-09 16:26:55 -07:00
|
|
|
(tt (cdr terms)))
|
2000-06-23 05:24:10 +00:00
|
|
|
(while tt
|
2022-07-09 16:26:55 -07:00
|
|
|
(cond
|
|
|
|
;; Strip `eshell-copy-output-handle'.
|
|
|
|
((and (consp (car tt))
|
|
|
|
(eq (caar tt) 'eshell-copy-output-handle))
|
|
|
|
(nconc eshell-current-redirections
|
|
|
|
(list (car tt)))
|
|
|
|
(setcdr tl (cddr tt))
|
|
|
|
(setq tt (cdr tt)))
|
|
|
|
;; Strip `eshell-set-output-handle' or
|
|
|
|
;; `eshell-set-all-output-handles' and the term immediately
|
|
|
|
;; after (the redirection target).
|
|
|
|
((and (consp (car tt))
|
|
|
|
(memq (caar tt) '(eshell-set-output-handle
|
|
|
|
eshell-set-all-output-handles)))
|
|
|
|
(unless (cdr tt)
|
|
|
|
(error "Missing redirection target"))
|
|
|
|
(nconc eshell-current-redirections
|
|
|
|
(list (list 'ignore
|
|
|
|
(append (car tt) (list (cadr tt))))))
|
|
|
|
(setcdr tl (cddr tt))
|
|
|
|
(setq tt (cddr tt)))
|
|
|
|
(t
|
|
|
|
(setq tt (cdr tt)
|
|
|
|
tl (cdr tl)))))
|
2000-06-23 05:24:10 +00:00
|
|
|
(setq eshell-current-redirections
|
2022-07-09 16:26:55 -07:00
|
|
|
(cdr eshell-current-redirections))))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
2013-09-17 11:19:12 -04:00
|
|
|
(defun eshell--apply-redirections (cmd)
|
2000-06-23 05:24:10 +00:00
|
|
|
"Apply any redirection which were specified for COMMAND."
|
|
|
|
(if eshell-current-redirections
|
2013-09-17 11:19:12 -04:00
|
|
|
`(progn
|
|
|
|
,@eshell-current-redirections
|
|
|
|
,cmd)
|
|
|
|
cmd))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
(defun eshell-create-handles
|
2013-09-17 11:19:12 -04:00
|
|
|
(stdout output-mode &optional stderr error-mode)
|
2000-06-23 05:24:10 +00:00
|
|
|
"Create a new set of file handles for a command.
|
|
|
|
The default location for standard output and standard error will go to
|
2013-09-17 11:19:12 -04:00
|
|
|
STDOUT and STDERR, respectively.
|
2000-08-29 00:47:45 +00:00
|
|
|
OUTPUT-MODE and ERROR-MODE are either `overwrite', `append' or `insert';
|
|
|
|
a nil value of mode defaults to `insert'."
|
2022-07-09 10:34:31 -07:00
|
|
|
(let* ((handles (make-vector eshell-number-of-handles nil))
|
|
|
|
(output-target (eshell-get-target stdout output-mode))
|
|
|
|
(error-target (if stderr
|
|
|
|
(eshell-get-target stderr error-mode)
|
|
|
|
output-target)))
|
2000-06-23 05:24:10 +00:00
|
|
|
(aset handles eshell-output-handle (cons output-target 1))
|
2022-07-09 10:34:31 -07:00
|
|
|
(aset handles eshell-error-handle (cons error-target 1))
|
2000-06-23 05:24:10 +00:00
|
|
|
handles))
|
|
|
|
|
|
|
|
(defun eshell-protect-handles (handles)
|
|
|
|
"Protect the handles in HANDLES from a being closed."
|
2022-07-09 10:34:31 -07:00
|
|
|
(dotimes (idx eshell-number-of-handles)
|
|
|
|
(when (aref handles idx)
|
|
|
|
(setcdr (aref handles idx)
|
|
|
|
(1+ (cdr (aref handles idx))))))
|
2000-06-23 05:24:10 +00:00
|
|
|
handles)
|
|
|
|
|
Only set Eshell execution result metavariables when non-nil
This simplifies usage of 'eshell-close-handles' in several places and
makes it work more like the docstring indicated it would.
* lisp/eshell/esh-io.el (eshell-close-handles): Only store EXIT-CODE
and RESULT if they're non-nil. Also, use 'dotimes' and 'dolist' to
simplify the implementation.
* lisp/eshell/em-alias.el (eshell-write-aliases-list):
* lisp/eshell/esh-cmd.el (eshell-rewrite-for-command)
(eshell-structure-basic-command): Adapt calls to
'eshell-close-handles'.
* test/lisp/eshell/eshell-tests.el (eshell-test/simple-command-result)
(eshell-test/lisp-command, eshell-test/lisp-command-with-quote)
(eshell-test/for-loop, eshell-test/for-name-loop)
(eshell-test/for-name-shadow-loop, eshell-test/lisp-command-args)
(eshell-test/subcommand, eshell-test/subcommand-args)
(eshell-test/subcommand-lisp): Move from here...
* test/lisp/eshell/esh-cmd-tests.el
(esh-cmd-test/simple-command-result, esh-cmd-test/lisp-command)
(esh-cmd-test/lisp-command-with-quote, esh-cmd-test/for-loop)
(esh-cmd-test/for-name-loop, esh-cmd-test/for-name-shadow-loop)
(esh-cmd-test/lisp-command-args, esh-cmd-test/subcommand)
(esh-cmd-test/subcommand-args, esh-cmd-test/subcommand-lisp): ... to
here.
(esh-cmd-test/and-operator, esh-cmd-test/or-operator)
(esh-cmd-test/for-loop-list, esh-cmd-test/for-loop-multiple-args)
(esh-cmd-test/while-loop, esh-cmd-test/until-loop)
(esh-cmd-test/if-statement, esh-cmd-test/if-else-statement)
(esh-cmd-test/unless-statement, esh-cmd-test/unless-else-statement):
New tests.
* doc/misc/eshell.texi (Invocation): Explain '&&' and '||'.
(for loop): Move from here...
(Control Flow): ... to here, and add documentation for other control
flow forms.
2022-08-06 13:37:28 -07:00
|
|
|
(defun eshell-close-handles (&optional exit-code result handles)
|
|
|
|
"Close all of the current HANDLES, taking refcounts into account.
|
|
|
|
If HANDLES is nil, use `eshell-current-handles'.
|
|
|
|
|
|
|
|
EXIT-CODE is the process exit code (zero, if the command
|
|
|
|
completed successfully). If nil, then use the exit code already
|
|
|
|
set in `eshell-last-command-status'.
|
|
|
|
|
|
|
|
RESULT is the quoted value of the last command. If nil, then use
|
|
|
|
the value already set in `eshell-last-command-result'."
|
|
|
|
(when exit-code
|
|
|
|
(setq eshell-last-command-status exit-code))
|
|
|
|
(when result
|
|
|
|
(cl-assert (eq (car result) 'quote))
|
|
|
|
(setq eshell-last-command-result (cadr result)))
|
|
|
|
(let ((handles (or handles eshell-current-handles)))
|
|
|
|
(dotimes (idx eshell-number-of-handles)
|
|
|
|
(when-let ((handle (aref handles idx)))
|
|
|
|
(setcdr handle (1- (cdr handle)))
|
|
|
|
(when (= (cdr handle) 0)
|
|
|
|
(dolist (target (ensure-list (car (aref handles idx))))
|
|
|
|
(eshell-close-target target (= eshell-last-command-status 0)))
|
|
|
|
(setcar handle nil))))))
|
|
|
|
|
2022-07-09 10:34:31 -07:00
|
|
|
(defun eshell-set-output-handle (index mode &optional target handles)
|
|
|
|
"Set handle INDEX for the current HANDLES to point to TARGET using MODE.
|
|
|
|
If HANDLES is nil, use `eshell-current-handles'."
|
|
|
|
(when target
|
|
|
|
(let ((handles (or handles eshell-current-handles)))
|
|
|
|
(if (and (stringp target)
|
|
|
|
(string= target (null-device)))
|
|
|
|
(aset handles index nil)
|
|
|
|
(let ((where (eshell-get-target target mode))
|
|
|
|
(current (car (aref handles index))))
|
|
|
|
(if (listp current)
|
|
|
|
(unless (member where current)
|
|
|
|
(setq current (append current (list where))))
|
|
|
|
(setq current (list where)))
|
|
|
|
(if (not (aref handles index))
|
|
|
|
(aset handles index (cons nil 1)))
|
|
|
|
(setcar (aref handles index) current))))))
|
|
|
|
|
2022-07-09 16:26:55 -07:00
|
|
|
(defun eshell-copy-output-handle (index index-to-copy &optional handles)
|
|
|
|
"Copy the handle INDEX-TO-COPY to INDEX for the current HANDLES.
|
|
|
|
If HANDLES is nil, use `eshell-current-handles'."
|
|
|
|
(let* ((handles (or handles eshell-current-handles))
|
|
|
|
(handle-to-copy (car (aref handles index-to-copy))))
|
|
|
|
(setcar (aref handles index)
|
|
|
|
(if (listp handle-to-copy)
|
|
|
|
(copy-sequence handle-to-copy)
|
|
|
|
handle-to-copy))))
|
|
|
|
|
|
|
|
(defun eshell-set-all-output-handles (mode &optional target handles)
|
|
|
|
"Set output and error HANDLES to point to TARGET using MODE.
|
|
|
|
If HANDLES is nil, use `eshell-current-handles'."
|
|
|
|
(eshell-set-output-handle eshell-output-handle mode target handles)
|
|
|
|
(eshell-copy-output-handle eshell-error-handle eshell-output-handle handles))
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
(defun eshell-close-target (target status)
|
|
|
|
"Close an output TARGET, passing STATUS as the result.
|
|
|
|
STATUS should be non-nil on successful termination of the output."
|
|
|
|
(cond
|
|
|
|
((symbolp target) nil)
|
|
|
|
|
|
|
|
;; If we were redirecting to a file, save the file and close the
|
|
|
|
;; buffer.
|
|
|
|
((markerp target)
|
|
|
|
(let ((buf (marker-buffer target)))
|
|
|
|
(when buf ; somebody's already killed it!
|
|
|
|
(save-current-buffer
|
|
|
|
(set-buffer buf)
|
|
|
|
(when eshell-output-file-buffer
|
|
|
|
(save-buffer)
|
|
|
|
(when (eq eshell-output-file-buffer t)
|
|
|
|
(or status (set-buffer-modified-p nil))
|
|
|
|
(kill-buffer buf)))))))
|
|
|
|
|
|
|
|
;; If we're redirecting to a process (via a pipe, or process
|
|
|
|
;; redirection), send it EOF so that it knows we're finished.
|
2000-08-29 00:47:45 +00:00
|
|
|
((eshell-processp target)
|
2022-07-19 21:36:54 -07:00
|
|
|
;; According to POSIX.1-2017, section 11.1.9, when communicating
|
|
|
|
;; via terminal, sending EOF causes all bytes waiting to be read
|
|
|
|
;; to be sent to the process immediately. Thus, if there are any
|
|
|
|
;; bytes waiting, we need to send EOF twice: once to flush the
|
|
|
|
;; buffer, and a second time to cause the next read() to return a
|
|
|
|
;; size of 0, indicating end-of-file to the reading process.
|
|
|
|
;; However, some platforms (e.g. Solaris) actually require sending
|
|
|
|
;; a *third* EOF. Since sending extra EOFs while the process is
|
|
|
|
;; running are a no-op, we'll just send the maximum we'd ever
|
|
|
|
;; need. See bug#56025 for further details.
|
|
|
|
(let ((i 0)
|
|
|
|
;; Only call `process-send-eof' once if communicating via a
|
|
|
|
;; pipe (in truth, this just closes the pipe).
|
|
|
|
(max-attempts (if (process-tty-name target 'stdin) 3 1)))
|
|
|
|
(while (and (<= (cl-incf i) max-attempts)
|
2022-06-26 18:27:20 +02:00
|
|
|
(eq (process-status target) 'run))
|
|
|
|
(process-send-eof target))))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;; A plain function redirection needs no additional arguments
|
|
|
|
;; passed.
|
|
|
|
((functionp target)
|
|
|
|
(funcall target status))
|
|
|
|
|
|
|
|
;; But a more complicated function redirection (which can only
|
|
|
|
;; happen with aliases at the moment) has arguments that need to be
|
|
|
|
;; passed along with it.
|
|
|
|
((consp target)
|
|
|
|
(apply (car target) status (cdr target)))))
|
|
|
|
|
|
|
|
(defun eshell-kill-append (string)
|
|
|
|
"Call `kill-append' with STRING, if it is indeed a string."
|
|
|
|
(if (stringp string)
|
|
|
|
(kill-append string nil)))
|
|
|
|
|
|
|
|
(defun eshell-clipboard-append (string)
|
|
|
|
"Call `kill-append' with STRING, if it is indeed a string."
|
|
|
|
(if (stringp string)
|
2016-12-10 18:11:56 -08:00
|
|
|
(let ((select-enable-clipboard t))
|
2000-06-23 05:24:10 +00:00
|
|
|
(kill-append string nil))))
|
|
|
|
|
|
|
|
(defun eshell-get-target (target &optional mode)
|
|
|
|
"Convert TARGET, which is a raw argument, into a valid output target.
|
2000-08-29 00:47:45 +00:00
|
|
|
MODE is either `overwrite', `append' or `insert'; if it is omitted or nil,
|
|
|
|
it defaults to `insert'."
|
2000-06-23 05:24:10 +00:00
|
|
|
(setq mode (or mode 'insert))
|
|
|
|
(cond
|
|
|
|
((stringp target)
|
|
|
|
(let ((redir (assoc target eshell-virtual-targets)))
|
2004-05-15 22:45:35 +00:00
|
|
|
(if redir
|
|
|
|
(if (nth 2 redir)
|
|
|
|
(funcall (nth 1 redir) mode)
|
|
|
|
(nth 1 redir))
|
|
|
|
(let* ((exists (get-file-buffer target))
|
|
|
|
(buf (find-file-noselect target t)))
|
|
|
|
(with-current-buffer buf
|
2010-07-30 19:25:06 -04:00
|
|
|
(if buffer-file-read-only
|
2004-05-15 22:45:35 +00:00
|
|
|
(error "Cannot write to read-only file `%s'" target))
|
2010-07-30 19:25:06 -04:00
|
|
|
(setq buffer-read-only nil)
|
2020-12-04 10:55:50 +01:00
|
|
|
(setq-local eshell-output-file-buffer
|
|
|
|
(if (eq exists buf) 0 t))
|
2004-05-15 22:45:35 +00:00
|
|
|
(cond ((eq mode 'overwrite)
|
|
|
|
(erase-buffer))
|
|
|
|
((eq mode 'append)
|
|
|
|
(goto-char (point-max))))
|
|
|
|
(point-marker))))))
|
|
|
|
|
2015-05-15 19:42:00 -07:00
|
|
|
|
|
|
|
((bufferp target)
|
|
|
|
(with-current-buffer target
|
|
|
|
(cond ((eq mode 'overwrite)
|
|
|
|
(erase-buffer))
|
|
|
|
((eq mode 'append)
|
|
|
|
(goto-char (point-max))))
|
|
|
|
(point-marker)))
|
2004-05-15 22:45:35 +00:00
|
|
|
|
|
|
|
((functionp target) nil)
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
((symbolp target)
|
|
|
|
(if (eq mode 'overwrite)
|
|
|
|
(set target nil))
|
|
|
|
target)
|
2004-05-15 22:45:35 +00:00
|
|
|
|
2000-08-29 00:47:45 +00:00
|
|
|
((or (eshell-processp target)
|
2000-06-23 05:24:10 +00:00
|
|
|
(markerp target))
|
|
|
|
target)
|
2004-05-15 22:45:35 +00:00
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
(t
|
2005-03-25 08:33:09 +00:00
|
|
|
(error "Invalid redirection target: %s"
|
2000-06-23 05:24:10 +00:00
|
|
|
(eshell-stringify target)))))
|
|
|
|
|
2022-08-28 20:50:27 -07:00
|
|
|
(defun eshell-interactive-output-p (&optional index handles)
|
|
|
|
"Return non-nil if the specified handle is bound for interactive display.
|
|
|
|
HANDLES is the set of handles to check; if nil, use
|
|
|
|
`eshell-current-handles'.
|
|
|
|
|
|
|
|
INDEX is the handle index to check. If nil, check
|
|
|
|
`eshell-output-handle'. If `all', check both
|
|
|
|
`eshell-output-handle' and `eshell-error-handle'."
|
|
|
|
(let ((handles (or handles eshell-current-handles))
|
|
|
|
(index (or index eshell-output-handle)))
|
|
|
|
(if (eq index 'all)
|
|
|
|
(and (eq (car (aref handles eshell-output-handle)) t)
|
|
|
|
(eq (car (aref handles eshell-error-handle)) t))
|
|
|
|
(eq (car (aref handles index)) t))))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
(defvar eshell-print-queue nil)
|
|
|
|
(defvar eshell-print-queue-count -1)
|
|
|
|
|
2007-12-05 07:06:02 +00:00
|
|
|
(defsubst eshell-print (object)
|
|
|
|
"Output OBJECT to the standard output handle."
|
|
|
|
(eshell-output-object object eshell-output-handle))
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
(defun eshell-flush (&optional reset-p)
|
|
|
|
"Flush out any lines that have been queued for printing.
|
|
|
|
Must be called before printing begins with -1 as its argument, and
|
|
|
|
after all printing is over with no argument."
|
|
|
|
(ignore
|
|
|
|
(if reset-p
|
|
|
|
(setq eshell-print-queue nil
|
|
|
|
eshell-print-queue-count reset-p)
|
|
|
|
(if eshell-print-queue
|
|
|
|
(eshell-print eshell-print-queue))
|
|
|
|
(eshell-flush 0))))
|
|
|
|
|
|
|
|
(defun eshell-init-print-buffer ()
|
|
|
|
"Initialize the buffered printing queue."
|
|
|
|
(eshell-flush -1))
|
|
|
|
|
|
|
|
(defun eshell-buffered-print (&rest strings)
|
|
|
|
"A buffered print -- *for strings only*."
|
|
|
|
(if (< eshell-print-queue-count 0)
|
|
|
|
(progn
|
|
|
|
(eshell-print (apply 'concat strings))
|
|
|
|
(setq eshell-print-queue-count 0))
|
|
|
|
(if (= eshell-print-queue-count eshell-print-queue-size)
|
|
|
|
(eshell-flush))
|
|
|
|
(setq eshell-print-queue
|
|
|
|
(concat eshell-print-queue (apply 'concat strings))
|
|
|
|
eshell-print-queue-count (1+ eshell-print-queue-count))))
|
|
|
|
|
|
|
|
(defsubst eshell-error (object)
|
2000-08-29 00:47:45 +00:00
|
|
|
"Output OBJECT to the standard error handle."
|
2000-06-23 05:24:10 +00:00
|
|
|
(eshell-output-object object eshell-error-handle))
|
|
|
|
|
|
|
|
(defsubst eshell-errorn (object)
|
2000-08-29 00:47:45 +00:00
|
|
|
"Output OBJECT followed by a newline to the standard error handle."
|
2000-06-23 05:24:10 +00:00
|
|
|
(eshell-error object)
|
|
|
|
(eshell-error "\n"))
|
|
|
|
|
|
|
|
(defsubst eshell-printn (object)
|
2000-08-29 00:47:45 +00:00
|
|
|
"Output OBJECT followed by a newline to the standard output handle."
|
2000-06-23 05:24:10 +00:00
|
|
|
(eshell-print object)
|
|
|
|
(eshell-print "\n"))
|
|
|
|
|
Silence many eshell compilation warnings
* lisp/eshell/em-tramp.el: Adjust requires.
(eshell-parse-command): Autoload.
* lisp/eshell/em-xtra.el: Adjust requires.
(eshell-parse-command): Autoload.
* lisp/eshell/esh-ext.el: Adjust requires.
(eshell-parse-command, eshell-close-handles): Autoload.
* lisp/eshell/esh-io.el: Adjust requires.
(eshell-output-filter): Autoload.
* lisp/eshell/esh-util.el: No need to load tramp when compiling.
(tramp-file-name-structure, ange-ftp-ls, ange-ftp-file-modtime): Declare.
(eshell-parse-ange-ls): Require ange-ftp and tramp.
* lisp/eshell/em-alias.el, lisp/eshell/em-banner.el, lisp/eshell/em-basic.el:
* lisp/eshell/em-cmpl.el, lisp/eshell/em-glob.el, lisp/eshell/em-pred.el:
* lisp/eshell/em-prompt.el, lisp/eshell/em-rebind.el, lisp/eshell/em-smart.el:
* lisp/eshell/em-term.el, lisp/eshell/esh-arg.el, lisp/eshell/esh-mode.el:
* lisp/eshell/esh-opt.el, lisp/eshell/esh-proc.el:
* lisp/eshell/esh-var.el: Adjust requires.
* lisp/eshell/eshell.el: Do not require esh-util twice.
(eshell-add-input-to-history): Declare.
(eshell-command): Check history module is active before using it.
2013-05-22 21:57:27 -07:00
|
|
|
(autoload 'eshell-output-filter "esh-mode")
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
(defun eshell-output-object-to-target (object target)
|
|
|
|
"Insert OBJECT into TARGET.
|
|
|
|
Returns what was actually sent, or nil if nothing was sent."
|
|
|
|
(cond
|
|
|
|
((functionp target)
|
|
|
|
(funcall target object))
|
|
|
|
|
|
|
|
((symbolp target)
|
|
|
|
(if (eq target t) ; means "print to display"
|
|
|
|
(eshell-output-filter nil (eshell-stringify object))
|
|
|
|
(if (not (symbol-value target))
|
|
|
|
(set target object)
|
|
|
|
(setq object (eshell-stringify object))
|
|
|
|
(if (not (stringp (symbol-value target)))
|
|
|
|
(set target (eshell-stringify
|
|
|
|
(symbol-value target))))
|
|
|
|
(set target (concat (symbol-value target) object)))))
|
|
|
|
|
|
|
|
((markerp target)
|
|
|
|
(if (buffer-live-p (marker-buffer target))
|
|
|
|
(with-current-buffer (marker-buffer target)
|
|
|
|
(let ((moving (= (point) target)))
|
|
|
|
(save-excursion
|
|
|
|
(goto-char target)
|
2004-05-15 22:45:35 +00:00
|
|
|
(unless (stringp object)
|
|
|
|
(setq object (eshell-stringify object)))
|
2000-06-23 05:24:10 +00:00
|
|
|
(insert-and-inherit object)
|
|
|
|
(set-marker target (point-marker)))
|
|
|
|
(if moving
|
|
|
|
(goto-char target))))))
|
|
|
|
|
2000-08-29 00:47:45 +00:00
|
|
|
((eshell-processp target)
|
2022-02-01 19:16:00 -08:00
|
|
|
(unless (stringp object)
|
|
|
|
(setq object (eshell-stringify object)))
|
2022-08-22 09:53:24 -07:00
|
|
|
(condition-case err
|
2022-02-01 19:16:00 -08:00
|
|
|
(process-send-string target object)
|
2022-08-22 09:53:24 -07:00
|
|
|
(error
|
|
|
|
;; If `process-send-string' raises an error and the process has
|
|
|
|
;; finished, treat it as a broken pipe. Otherwise, just
|
|
|
|
;; re-throw the signal.
|
|
|
|
(if (memq (process-status target)
|
|
|
|
'(run stop open closed))
|
|
|
|
(signal (car err) (cdr err))
|
|
|
|
(signal 'eshell-pipe-broken (list target))))))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
((consp target)
|
|
|
|
(apply (car target) object (cdr target))))
|
|
|
|
object)
|
|
|
|
|
|
|
|
(defun eshell-output-object (object &optional handle-index handles)
|
2022-01-19 21:57:38 -08:00
|
|
|
"Insert OBJECT, using HANDLE-INDEX specifically.
|
|
|
|
If HANDLE-INDEX is nil, output to `eshell-output-handle'.
|
|
|
|
HANDLES is the set of file handles to use; if nil, use
|
|
|
|
`eshell-current-handles'."
|
2000-06-23 05:24:10 +00:00
|
|
|
(let ((target (car (aref (or handles eshell-current-handles)
|
|
|
|
(or handle-index eshell-output-handle)))))
|
2022-01-19 21:57:38 -08:00
|
|
|
(if (listp target)
|
|
|
|
(while target
|
|
|
|
(eshell-output-object-to-target object (car target))
|
|
|
|
(setq target (cdr target)))
|
|
|
|
(eshell-output-object-to-target object target)
|
|
|
|
;; Explicitly return nil to match the list case above.
|
|
|
|
nil)))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
Eshell: Try to untangle the dependencies; move 'provide's to the end
* lisp/eshell/esh-arg.el: Move defsubst and vars before first use.
Don't require `esh-mode but esh-util instead.
* lisp/eshell/esh-cmd.el: Require esh-module and esh-io.
* lisp/eshell/esh-ext.el: Don't require esh-proc nor esh-cmd.
(eshell-external-command): Require esh-proc for
eshell-gather-process-output.
* lisp/eshell/esh-mode.el: Don't require esh-io nor esh-var, but
require esh-arg.
(eshell-directory-name): Move from eshell.el.
* lisp/eshell/esh-module.el: Don't require eshell.
* lisp/eshell/esh-opt.el: Don't require esh-ext at top-level.
(eshell--do-opts, eshell-show-usage): Require it here instead.
* lisp/eshell/esh-proc.el: Don't require esh-cmd, but require esh-io.
(eshell-reset-after-proc, eshell-record-process-object)
(eshell-gather-process-output, eshell-send-eof-to-process):
Require esh-mode and esh-var here.
* lisp/eshell/esh-var.el: Require esh-module, esh-arg, and esh-io.
* lisp/eshell/eshell.el: Require esh-module, esh-proc, esh-io, and esh-cmd.
But don't require esh-mode.
(eshell-directory-name): Move to esh-mode.
(eshell-return-exits-minibuffer): Don't bind 'return' and 'M-return'
since we already bind RET and M-RET.
2019-04-08 14:28:34 -04:00
|
|
|
(provide 'esh-io)
|
2000-06-23 05:24:10 +00:00
|
|
|
;;; esh-io.el ends here
|