How can the *shell command output* buffer be kept in the background?
shell-command
takes an optional argument OUTPUT-BUFFER
where you can specify the buffer to output to. If it is t
(actually not a buffer-name and not nil
) it will be output in the current buffer. So we wrap this into a with-temp-buffer
and will never have to bother with it:
(with-temp-buffer
(shell-command "cat ~/.emacs.d/init.el" t))
Maybe using shell-command
was the root of the problem. I think I found a solution with call-process
which works, although there may be a more elegant way:
(call-process-shell-command
"cat ~/.emacs.d/init.el"
nil "*Shell Command Output*" t
)