mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 12:31:25 +00:00
fixup! Add basic support in Eshell for piping to Lisp commands
This commit is contained in:
parent
e9847f8263
commit
06ebfca7f4
1 changed files with 8 additions and 5 deletions
|
|
@ -61,8 +61,8 @@
|
||||||
|
|
||||||
(defgroup eshell-worker nil
|
(defgroup eshell-worker nil
|
||||||
"Eshell workers provide a way to construct process-like objects in Emacs
|
"Eshell workers provide a way to construct process-like objects in Emacs
|
||||||
Lisp that can serve as pipe targets, allowing you to manipulating other
|
Lisp that can serve as pipe targets, allowing you to manipulate other
|
||||||
command's output with ordinary Lisp."
|
commands' output with ordinary Lisp."
|
||||||
:tag "Worker support"
|
:tag "Worker support"
|
||||||
:group 'eshell)
|
:group 'eshell)
|
||||||
|
|
||||||
|
|
@ -195,18 +195,21 @@ sent to TARGET (e.g. a string representing OBJECT)."
|
||||||
(let ((buf-or-val (eshell-accumulate-worker-buffer-or-value target)))
|
(let ((buf-or-val (eshell-accumulate-worker-buffer-or-value target)))
|
||||||
(cond
|
(cond
|
||||||
((bufferp buf-or-val)
|
((bufferp buf-or-val)
|
||||||
|
(setq object (eshell-stringify object t))
|
||||||
(with-current-buffer buf-or-val
|
(with-current-buffer buf-or-val
|
||||||
(insert (eshell-stringify object t))))
|
(insert object)))
|
||||||
(buf-or-val
|
(buf-or-val
|
||||||
(cl-assert (listp buf-or-val))
|
(cl-assert (listp buf-or-val))
|
||||||
|
(setq object (eshell-concat t (car buf-or-val) object))
|
||||||
(with-current-buffer (eshell-accumulate-worker--make-buffer target)
|
(with-current-buffer (eshell-accumulate-worker--make-buffer target)
|
||||||
(insert (eshell-concat t (car buf-or-val) object))))
|
(insert object)))
|
||||||
((stringp object)
|
((stringp object)
|
||||||
(with-current-buffer (eshell-accumulate-worker--make-buffer target)
|
(with-current-buffer (eshell-accumulate-worker--make-buffer target)
|
||||||
(insert object)))
|
(insert object)))
|
||||||
(t
|
(t
|
||||||
(setf (eshell-accumulate-worker-buffer-or-value target)
|
(setf (eshell-accumulate-worker-buffer-or-value target)
|
||||||
(list object))))))
|
(list object))))
|
||||||
|
object))
|
||||||
|
|
||||||
(cl-defmethod eshell-close-target ((target eshell-accumulate-worker) _status)
|
(cl-defmethod eshell-close-target ((target eshell-accumulate-worker) _status)
|
||||||
"Close the accumulate-worker TARGET, flushing its buffer."
|
"Close the accumulate-worker TARGET, flushing its buffer."
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue