Suppose that I have a
*shell* buffer (i.e. a subordinate shell, started with
M-x shell). Suppose also that at this shell's prompt, I can execute some command
foo that sends some output to
I know that, in general, I can always select the region in the
*shell* buffer corresponding to
foo's output and add it to the kill-ring with
I'd like, however, to pipe
foo's output directly to the kill-ring, so that it never appears in the
*shell* buffer (and thus obviating the need to select the appropriate region and run
Is there a way to do this?
For example, is there some Unix command
bar such that running
% foo | bar
*shell* buffer will cause the output of
foo to be added to Emacs's kill-ring?
In case there's a difference between them, I'd like to know the answer to this question for 3 different cases (in order of importance):
- Emacs is running as an X11 application (Debian Linux + Xfce4 + Xfwm4);
- Emacs is running in "text-only mode" (e.g. started with
- Emacs is running as a Cocoa application in OS X (i.e. it is
/Applications/Emacs.app, installed from here);
PS: I just learned that
eshell (not to be confused with
comint) implements the
/dev/kill pseudo-file, which solve's this post's problem (i.e.
foo > /dev/kill adds
foo's output to the kill-ring). Unfortunately, IME, using
eshell has always been an absolute nightmare, since so little of what I know from
bash works with
eshell; I don't want to learn a whole new---and totally weird--shell from the bottom up just to solve this post's problem. Therefore, at the moment at least,
eshell-based solutions are out of the question. This may change, however, depending on the answers I get to another question I just posted.