Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Programatically suppress "Async Shell command" buffer

923 views
Skip to first unread message

Peter Dyballa

unread,
Jul 7, 2009, 5:32:46 AM7/7/09
to gearheart, Help-gn...@gnu.org

Am 06.07.2009 um 15:43 schrieb gearheart:

> When async shell-command is run, i get empty buffer that takes like
> half of
> the screen.


Half of the frame in which shell-command was run is standard
behaviour (could be an option exists to set size as for example for
the *compilation* buffer, compilation-window-height). If your shell
command does return nothing or white space, then the temporary *Shell
Command Output* buffer will look empty (in the fringe you can have
exact indicators). If your shell command, say, a simple ls, should
return readable output and you get an empty *Shell Command Output*
buffer, then something is faulty. Then try the same by launching GNU
Emacs as 'emacs -Q' without any customisation.

--
Greetings

Pete

People say that if you play Microsoft CD's backwards, you hear
satanic things, but that's nothing, because if you play them
forwards, they install MS Windows.

gearheart

unread,
Jul 7, 2009, 2:00:54 PM7/7/09
to Help-gn...@gnu.org


Peter Dyballa wrote:
>
>
> Am 06.07.2009 um 15:43 schrieb gearheart:
>
>> When async shell-command is run, i get empty buffer that takes like
>> half of
>> the screen.
>
>
> Half of the frame in which shell-command was run is standard
> behaviour (could be an option exists to set size as for example for
> the *compilation* buffer, compilation-window-height). If your shell
> command does return nothing or white space, then the temporary *Shell
> Command Output* buffer will look empty (in the fringe you can have
> exact indicators). If your shell command, say, a simple ls, should
> return readable output and you get an empty *Shell Command Output*
> buffer, then something is faulty. Then try the same by launching GNU
> Emacs as 'emacs -Q' without any customisation.
>
>

oops, my bad.
to call async shell command without a buffer you need to run:
(shell-command "something&" (universal-argument))
--
View this message in context: http://www.nabble.com/Programatically-suppress-%22Async-Shell-command%22-buffer-tp24355670p24378496.html
Sent from the Emacs - Help mailing list archive at Nabble.com.

dnquark

unread,
Jul 9, 2009, 10:17:53 PM7/9/09
to
I was just trying to figure out how to get this to work; this helped
but there still is a problem: once the async shell command terminates,
whatever output it produces (I think it's on stderr) which would
normally go to the dedicated output buffer gets inserted into my
current buffer. How do I suppress all output from the command?..

On Jul 7, 2:00 pm, gearheart <yoyav...@gmail.com> wrote:
> Peter Dyballa wrote:
>
> > Am 06.07.2009 um 15:43 schrieb gearheart:
>

> >> When asyncshell-commandis run, i get empty buffer that takes like  
> >> half of
> >> the screen.
>
> > Half of the frame in whichshell-commandwas run is standard  


> > behaviour (could be an option exists to set size as for example for  
> > the *compilation* buffer, compilation-window-height). If yourshell 

> >commanddoes return nothing or white space, then the temporary *Shell 
> >CommandOutput* buffer will look empty (in the fringe you can have  
> > exact indicators). If yourshellcommand, say, a simple ls, should  


> > return readableoutputand you get an empty *ShellCommandOutput*  
> > buffer, then something is faulty. Then try the same by launching GNU  
> > Emacs as 'emacs -Q' without any customisation.
>
> oops, my bad.

> to call asyncshellcommandwithout a buffer you need to run:
> (shell-command"something&" (universal-argument))
> --
> View this message in context:http://www.nabble.com/Programatically-suppress-%22Async-Shell-command...

dnquark

unread,
Jul 9, 2009, 11:30:57 PM7/9/09
to
To add: I can redirect the command output to /dev/dull, but the
problem is that I cannot run the command in a dired buffer since it is
read-only. Is there a way to specify that the command produces no
output so that it could be possible to run in a read-only buffer,e.g.
dired?

On Jul 9, 10:17 pm, dnquark <dnqu...@gmail.com> wrote:
> I was just trying to figure out how to get this to work; this helped

> but there still is a problem: once the asyncshellcommand terminates,

Peter Dyballa

unread,
Jul 10, 2009, 6:48:50 AM7/10/09
to dnquark, help-gn...@gnu.org

Am 10.07.2009 um 05:30 schrieb dnquark:

> To add: I can redirect the command output to /dev/dull, but the
> problem is that I cannot run the command in a dired buffer since it is
> read-only. Is there a way to specify that the command produces no
> output so that it could be possible to run in a read-only buffer,e.g.
> dired?


I don't understand what you are trying to express. Can you give a
detailed example? With actual shell commands? A picture (ASCII) of
the dired buffer before and afterwards? And another example when you
launched GNU Emacs with -Q and applied the same example?

--
Greetings

Pete

You can learn many things from children. How much patience you have,
for instance.
– Franklin P. Jones

Peter Dyballa

unread,
Jul 10, 2009, 6:43:54 AM7/10/09
to dnquark, help-gn...@gnu.org

Am 10.07.2009 um 04:17 schrieb dnquark:

> How do I suppress all output from the command?


Most shell interpreters allow to redirect stderr (and stdin and
stdout) to files (or pipes). Just the read the documentation of your
shell interpreter.

GNU Emacs offers (the variable) shell-command-default-error-buffer –
if you are looking for this and not the shell interpreter docs.

--
Greetings

Pete

Wasting time is an important part of living.

Leo Alekseyev

unread,
Jul 10, 2009, 7:01:55 AM7/10/09
to Peter Dyballa, help-gn...@gnu.org
I already solved the problem by simply turning off the read-only
property of the dired buffer. I am interested to see if there is a
better fix though:


(defun terminal-here ()
"Launch external terminal in the current buffer's directory or current dired
directory. (Works by grabbing the directory name and passing as an argument to
a batch file. Note the (toggle-read-only) workaround; the command will not run
in dired mode without it."
(interactive)
(let ((dir "") (diredp nil))
(cond
((and (local-variable-p 'dired-directory) dired-directory)
(setq dir dired-directory)
(setq diredp t)
(toggle-read-only)
)
((stringp (buffer-file-name))
(setq dir (file-name-directory (buffer-file-name))))
)
(shell-command (concat "~/bin/mrxvt_win.bat \""dir"\" 2>/dev/null &")
(universal-argument))
(if diredp (toggle-read-only))
))


On Fri, Jul 10, 2009 at 6:48 AM, Peter Dyballa<Peter_...@web.de> wrote:
>
> Am 10.07.2009 um 05:30 schrieb dnquark:
>

>> To add: I can redirect the command output to /dev/dull, but the
>> problem is that I cannot run the command in a dired buffer since it is
>> read-only.  Is there a way to specify that the command produces no
>> output so that it could be possible to run in a read-only buffer,e.g.
>> dired?
>
>

Johan Bockgård

unread,
Jul 10, 2009, 7:02:00 AM7/10/09
to help-gn...@gnu.org
gearheart <yoya...@gmail.com> writes:

> When async shell-command is run, i get empty buffer that takes like
> half of the screen.

(call-process-shell-command "something" nil 0)

0 new messages