To redirect to a buffer, use #<buffer buffer-name>
, since Emacs 24.4, you can also use the shorthand #<buffer-name>
. For example,
echo hello >>> #<buffer *scratch*>
echo world >>> #<*scratch*>
It looks like it is possible to customize the syntax via the hook eshell-parse-argument-hook
, such as supporting #buffer-name
as well. Here is my attempt,
(defun eshell-parse-my-special-reference ()
(when (and (not eshell-current-argument)
(not eshell-current-quoted)
;; Don't overwrite `eshell-parse-special-reference'
(not (looking-at "#<\\(\\(buffer\\|process\\)\\s-\\)?"))
(looking-at "#\\(\\S-+\\)")
(match-string 1))
(goto-char (match-end 0)) ;; Go to the end of the match.
(list 'get-buffer-create (match-string 1))))
(add-hook 'eshell-parse-argument-hook #'eshell-parse-my-special-reference)
and the following worked as expected
echo foobar >>> #*scratch*
foo > #<bar>
works. You do not need the wordbuffer
. Don't know if that is still too much for you. Works for me on cygwin emacs 26.1. – Tobias Jun 19 '18 at 11:44Eshell does not support input redirection
. I had a look on the eshell manual and it mentions that this command should work. – rph Jun 19 '18 at 11:47emacs-version
). Doesfoo > #<bar>
also fail withemacs -Q
? – Tobias Jun 19 '18 at 12:58emacs -Q
, as well as withemacs --no-window-system
. – rph Jun 19 '18 at 14:01foo >>> #<bar>
? – Tobias Jun 19 '18 at 14:04