* how to set shell output always to *Shell Command Output*
@ 2010-09-13 6:17 Xah Lee
2010-09-16 12:57 ` TheFlyingDutchman
2010-09-16 13:00 ` TheFlyingDutchman
0 siblings, 2 replies; 7+ messages in thread
From: Xah Lee @ 2010-09-13 6:17 UTC (permalink / raw)
To: help-gnu-emacs
when running a shell command, if the output is small, it shows in the
“*Messages*” buffer.
is there a way to always have the output in the “*Shell Command
Output*” buffer?
thanks.
Xah
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to set shell output always to *Shell Command Output*
2010-09-13 6:17 how to set shell output always to *Shell Command Output* Xah Lee
@ 2010-09-16 12:57 ` TheFlyingDutchman
2010-09-16 14:13 ` Xah Lee
2010-09-16 13:00 ` TheFlyingDutchman
1 sibling, 1 reply; 7+ messages in thread
From: TheFlyingDutchman @ 2010-09-16 12:57 UTC (permalink / raw)
To: help-gnu-emacs
On Sep 12, 11:17 pm, Xah Lee <xah...@gmail.com> wrote:
> when running a shell command, if the output is small, it shows in the
> “*Messages*” buffer.
>
> is there a way to always have the output in the “*Shell Command
> Output*” buffer?
>
> thanks.
>
> Xah
Setting the symbol resize-mini-windows to nil seems to send output
that is more than one line to *Shell Command Output* and 1 line outout
to the mini buffer window.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to set shell output always to *Shell Command Output*
2010-09-13 6:17 how to set shell output always to *Shell Command Output* Xah Lee
2010-09-16 12:57 ` TheFlyingDutchman
@ 2010-09-16 13:00 ` TheFlyingDutchman
1 sibling, 0 replies; 7+ messages in thread
From: TheFlyingDutchman @ 2010-09-16 13:00 UTC (permalink / raw)
To: help-gnu-emacs
On Sep 12, 11:17 pm, Xah Lee <xah...@gmail.com> wrote:
> when running a shell command, if the output is small, it shows in the
> “*Messages*” buffer.
>
> is there a way to always have the output in the “*Shell Command
> Output*” buffer?
>
> thanks.
>
> Xah
Hello,
This is in reply to a message I lost track of in Gnus.
To always send a command output to a specified buffer.
(defun shell-command-with-buffer(cmd)
(interactive "sCommand:")
(shell-command cmd (set-buffer (get-buffer-create "*Shell Command
Output*")) nil))
Thanks.
mp
--
Michael Powe mich...@trollope.org Naugatuck CT USA
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to set shell output always to *Shell Command Output*
2010-09-16 12:57 ` TheFlyingDutchman
@ 2010-09-16 14:13 ` Xah Lee
2010-09-17 18:56 ` TheFlyingDutchman
0 siblings, 1 reply; 7+ messages in thread
From: Xah Lee @ 2010-09-16 14:13 UTC (permalink / raw)
To: help-gnu-emacs
On Sep 16, 5:57 am, TheFlyingDutchman <zzbba...@aol.com> wrote:
> On Sep 12, 11:17 pm, Xah Lee <xah...@gmail.com> wrote:
>
> > when running a shell command, if the output is small, it shows in the
> > “*Messages*” buffer.
>
> > is there a way to always have the output in the “*Shell Command
> > Output*” buffer?
>
> > thanks.
>
> > Xah
>
> Setting the symbol resize-mini-windows to nil seems to send output
> that is more than one line to *Shell Command Output* and 1 line outout
> to the mini buffer window.
humm... doesn't seems a satisfying solution. Just read the doc:
Otherwise, COMMAND is executed synchronously. The output appears in
the buffer `*Shell Command Output*'. If the output is short enough to
display in the echo area (which is determined by the variables
`resize-mini-windows' and `max-mini-window-height'), it is shown
there, but it is nonetheless available in buffer `*Shell Command
Output*' even though that buffer is not automatically displayed.
so the output is always in “*Shell Command Output*”, the trick is to
always switch to it, and with the default behavior of spliting window
to show it. Seems hard to do that...
anyway, not really important. Thanks and thanks mp.
Xah
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to set shell output always to *Shell Command Output*
2010-09-16 14:13 ` Xah Lee
@ 2010-09-17 18:56 ` TheFlyingDutchman
2010-09-17 19:25 ` Xah Lee
0 siblings, 1 reply; 7+ messages in thread
From: TheFlyingDutchman @ 2010-09-17 18:56 UTC (permalink / raw)
To: help-gnu-emacs
> humm... doesn't seems a satisfying solution. Just read the doc:
>
> Otherwise, COMMAND is executed synchronously. The output appears in
> the buffer `*Shell Command Output*'. If the output is short enough to
> display in the echo area (which is determined by the variables
> `resize-mini-windows' and `max-mini-window-height'), it is shown
> there, but it is nonetheless available in buffer `*Shell Command
> Output*' even though that buffer is not automatically displayed.
>
> so the output is always in “*Shell Command Output*”, the trick is to
> always switch to it, and with the default behavior of spliting window
> to show it. Seems hard to do that...
>
For me, on Emacs 23.2.1, when I have resize-mini-windows set to nil,
any shell-command that creates output of two lines or more, not only
displays in the *Shell Command Output* buffer, it also splits the
screen and displays *Shell Command Output* buffer if it is not already
displayed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to set shell output always to *Shell Command Output*
2010-09-17 18:56 ` TheFlyingDutchman
@ 2010-09-17 19:25 ` Xah Lee
2010-09-19 8:56 ` TheFlyingDutchman
0 siblings, 1 reply; 7+ messages in thread
From: Xah Lee @ 2010-09-17 19:25 UTC (permalink / raw)
To: help-gnu-emacs
On Sep 17, 11:56 am, TheFlyingDutchman <zzbba...@aol.com> wrote:
> > humm... doesn't seems a satisfying solution. Just read the doc:
>
> > Otherwise, COMMAND is executed synchronously. The output appears in
> > the buffer `*Shell Command Output*'. If the output is short enough to
> > display in the echo area (which is determined by the variables
> > `resize-mini-windows' and `max-mini-window-height'), it is shown
> > there, but it is nonetheless available in buffer `*Shell Command
> > Output*' even though that buffer is not automatically displayed.
>
> > so the output is always in “*Shell Command Output*”, the trick is to
> > always switch to it, and with the default behavior of spliting window
> > to show it. Seems hard to do that...
>
> For me, on Emacs 23.2.1, when I have resize-mini-windows set to nil,
> any shell-command that creates output of two lines or more, not only
> displays in the *Shell Command Output* buffer, it also splits the
> screen and displays *Shell Command Output* buffer if it is not already
> displayed.
but what if i do want the mini-buffer window to resize? i vaguely
recall i set it before but then when calling shell-command with long
shell lines it becomes one loong line that goes out of the window.
it seems to me the current behavior is trying to use one stone for 2
birds... not orthogonal.
would be nice if emacs has anoher var some like smart-redirect-output-
p.
Xah
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to set shell output always to *Shell Command Output*
2010-09-17 19:25 ` Xah Lee
@ 2010-09-19 8:56 ` TheFlyingDutchman
0 siblings, 0 replies; 7+ messages in thread
From: TheFlyingDutchman @ 2010-09-19 8:56 UTC (permalink / raw)
To: help-gnu-emacs
>
> but what if i do want the mini-buffer window to resize? i vaguely
> recall i set it before but then when calling shell-command with long
> shell lines it becomes one loong line that goes out of the window.
>
> it seems to me the current behavior is trying to use one stone for 2
> birds... not orthogonal.
>
> would be nice if emacs has anoher var some like smart-redirect-output-p.
>
There may be issues with this function, but it seems to do what you
want with regards to command output - of any size - always going to a
right-side window (I am using Windows 7, Emacs 23.2.1) - except when
*Shell Command Output* is already displayed in a window, in which case
output goes to the existing window. It also doesn't affect any
existing mini-buffer behavior.
(defun sh-cmd (command)
(interactive "sCommand: ")
(let ((buffer (get-buffer-create "*Shell Command Output*")))
(with-current-buffer buffer
(erase-buffer)
(call-process-region (point) (point) shell-file-name t
t nil shell-command-switch command)
(display-buffer (current-buffer)) ) )
)
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-09-19 8:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-13 6:17 how to set shell output always to *Shell Command Output* Xah Lee
2010-09-16 12:57 ` TheFlyingDutchman
2010-09-16 14:13 ` Xah Lee
2010-09-17 18:56 ` TheFlyingDutchman
2010-09-17 19:25 ` Xah Lee
2010-09-19 8:56 ` TheFlyingDutchman
2010-09-16 13:00 ` TheFlyingDutchman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).