For example, I want to be able to type something like:
$ git diff | tempbuffer
and have the diff opened in a new, unsaved buffer.
If you use eshell
you can redirect output to a buffer, e.g.
print foo > #<buffer bar>
which creates a new buffer bar
with the content 'foo'. For further details, see the Emacswiki at http://www.emacswiki.org/emacs/EshellRedirection.
You can just use M-! -- it will run the command within the same cwd as your shell buffer, and output the results to a *Shell Command Output*
buffer.
Note that if the results are brief, that buffer will not be raised and the output will be copied to the echo area; however the buffer is still used and available. C-hf shell-command
RET has details of what constitutes "brief" output:
If the output is short enough to display in the echo area (determined by the variable
max-mini-window-height
ifresize-mini-windows
is non-nil), it is shown there. Otherwise, the buffer containing the output is displayed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With