help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to set shell output always to *Shell Command Output*


From: TheFlyingDutchman
Subject: Re: how to set shell output always to *Shell Command Output*
Date: Wed, 08 Dec 2010 15:28:57 -0000
User-agent: G2/1.0

>
> 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))    )   )
)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]