unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to suppress/avoid *Async Shell Command* buffer?
@ 2013-05-18  0:03 Marius Hofert
  2013-05-18  8:48 ` Andreas Röhler
  0 siblings, 1 reply; 14+ messages in thread
From: Marius Hofert @ 2013-05-18  0:03 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I use

--8<---------------cut here---------------start------------->8---
(setq dired-guess-shell-alist-user
      '(("\\.\\(?:pdf\\|djvu\\|jp?g\\)\\'" "okular ? &")
        ("\\.html\\'" "google-chrome ? &")))
--8<---------------cut here---------------end--------------->8---

to open pdf files in dired-mode via "!". Once I do this, my dired buffer
is vertically divided into two pieces by opening a buffer named
*Async Shell Command*. The buffer does not show anything. It is quite
useless and *very* tedious to close (not only for pdf files). How can I
suppress this buffer / avoid this buffer being opened?

Here is what I found on this topic:
1)
http://stackoverflow.com/questions/3679930/how-to-automatically-remove-or-prevent-popping-up-async-shell-command-in-ema
2)
http://stackoverflow.com/questions/6915314/emacs-automatically-close-async-output-buffers-on-command-completion3)
http://stackoverflow.com/questions/12083228/how-do-i-speed-up-emacs-output-from-an-asynchronous-shell-command
4) http://stackoverflow.com/questions/13348230/create-buffer-and-immediately-hide-it
5) http://stackoverflow.com/questions/7298372/run-a-program-from-emacs-and-dont-wait-for-output
6) https://groups.google.com/forum/?fromgroups#!topic/gnu.emacs.help/TNqE7R7mULk

1), 2), 3): idea with save-window-excursion
4), 5): idea with start-process
6): call-process-shell-command

The problem is that I don't know how to *use* (one of) these approaches,
especially not with dired-mode's "!". Ideally, the buffer *Async Shell
Command* is not opened at all or at least is opened in the background
but does not 'destroy' (take up space from) the current buffer.

Cheers,

Marius



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to suppress/avoid *Async Shell Command* buffer?
  2013-05-18  0:03 Marius Hofert
@ 2013-05-18  8:48 ` Andreas Röhler
  0 siblings, 0 replies; 14+ messages in thread
From: Andreas Röhler @ 2013-05-18  8:48 UTC (permalink / raw)
  To: help-gnu-emacs

Am 18.05.2013 02:03, schrieb Marius Hofert:
> Hi,
>
> I use
>
> --8<---------------cut here---------------start------------->8---
> (setq dired-guess-shell-alist-user
>        '(("\\.\\(?:pdf\\|djvu\\|jp?g\\)\\'" "okular ? &")
>          ("\\.html\\'" "google-chrome ? &")))
> --8<---------------cut here---------------end--------------->8---
>
> to open pdf files in dired-mode via "!".
[ ... ]

Can you tell a little bit more what's the purpose?

Is it just to open a pdf for viewing or should a shell-skript edit them?

Best,

Andreas



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to suppress/avoid *Async Shell Command* buffer?
@ 2013-05-18 10:05 Marius Hofert
  2013-05-18 12:47 ` Andreas Röhler
  0 siblings, 1 reply; 14+ messages in thread
From: Marius Hofert @ 2013-05-18 10:05 UTC (permalink / raw)
  To: andreas.roehler; +Cc: help-gnu-emacs

Hi Andreas,

Thanks a lot for helping.

The purpose is simply for opening them (asynchronously), viewing the pdf
(continuing to work in Emacs), (maybe add annotations to the pdf and save
it).

I use 'dired-mode' as 'file manager' and often would like to open and view
pdfs in Okular. I also have other 'dired-guess-shell-alist-user' settings
like opening pngs in eog or mp3s in VLC. But everytime I open a file, I get
this annoying *Async Shell Command* buffer (either empty or with debug
output) and I have to manually close it via C-x 0 etc. to get rid of it. I
know that it might contain useful information sometimes and I wouldn't be
against it appearing hidden (in the buffer list). But being distracted by
this buffer in dired-mode is really unpleasant. If I only knew more emacs
lisp...

Cheers,

Marius


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to suppress/avoid *Async Shell Command* buffer?
  2013-05-18 10:05 How to suppress/avoid *Async Shell Command* buffer? Marius Hofert
@ 2013-05-18 12:47 ` Andreas Röhler
  2013-05-18 13:58   ` Marius Hofert
  0 siblings, 1 reply; 14+ messages in thread
From: Andreas Röhler @ 2013-05-18 12:47 UTC (permalink / raw)
  To: Marius Hofert; +Cc: help-gnu-emacs

Am 18.05.2013 12:05, schrieb Marius Hofert:
> Hi Andreas,
>
> Thanks a lot for helping.
>
> The purpose is simply for opening them (asynchronously), viewing the pdf

Hmm, probably don't understand yet, what is the difference WRT RET --dired-find-file-- ?

> (continuing to work in Emacs), (maybe add annotations to the pdf and save
> it).
>

which would mean edit, not just view the pdf(?)


> I use 'dired-mode' as 'file manager' and often would like to open and view
> pdfs in Okular. I also have other 'dired-guess-shell-alist-user' settings
> like opening pngs in eog or mp3s in VLC. But everytime I open a file, I get
> this annoying *Async Shell Command* buffer (either empty or with debug
> output) and I have to manually close it via C-x 0 etc. to get rid of it.


Please give an example of the shell-command used than.

  I
> know that it might contain useful information sometimes and I wouldn't be
> against it appearing hidden (in the buffer list). But being distracted by
> this buffer in dired-mode is really unpleasant. If I only knew more emacs
> lisp...
>


Let's see how it comes out in this case.

Andreas

> Cheers,
>
> Marius
>




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to suppress/avoid *Async Shell Command* buffer?
  2013-05-18 12:47 ` Andreas Röhler
@ 2013-05-18 13:58   ` Marius Hofert
  2013-05-18 14:33     ` Andreas Röhler
  2013-05-18 14:39     ` Hongxu Chen
  0 siblings, 2 replies; 14+ messages in thread
From: Marius Hofert @ 2013-05-18 13:58 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: help-gnu-emacs


Andreas Röhler writes:

> Am 18.05.2013 12:05, schrieb Marius Hofert:
>> Hi Andreas,
>>
>> Thanks a lot for helping.
>>
>> The purpose is simply for opening them (asynchronously), viewing the pdf
>
> Hmm, probably don't understand yet, what is the difference WRT RET --dired-find-file-- ?

dired-find-file opens it *in Emacs*. I can't edit it then and it's also
a bit slow.

I would like to open the file with *Okular* from Emacs.

>
>> (continuing to work in Emacs), (maybe add annotations to the pdf and save
>> it).
>>
>
> which would mean edit, not just view the pdf(?)

yes.

Maybe I wasn't clear. You can use "!" in dired mode to execute commands
on the file at point. I use that to call Okular to open the file
(in Okular; standalone). The same happens when I cd in the terminal to
the directory containing the pdf file, then type 'okular foo.pdf &', but
that's more tedious of course (also, it exits Okular if I quit the
terminal -- which does not happen if I start it from dired-mode).

>
>
>
>> I use 'dired-mode' as 'file manager' and often would like to open and view
>> pdfs in Okular. I also have other 'dired-guess-shell-alist-user' settings
>> like opening pngs in eog or mp3s in VLC. But everytime I open a file, I get
>> this annoying *Async Shell Command* buffer (either empty or with debug
>> output) and I have to manually close it via C-x 0 etc. to get rid of it.
>
>
> Please give an example of the shell-command used than.

Due to my settings for dired-guess-shell-alist-user (as posted), I
receive the suggestion 'okular ? &' when hitting '!' with the point on
the pdf file. This executes "okular foo.pdf &" in the background (as far
as I know), where 'foo.pdf' is the pdf file at point. Hitting RET starts
Okular, opens foo.pdf (great), but also opens the *Async Shell Command*
buffer in Emacs (as described; not so great).

Cheers,

Marius

>
>   I
>> know that it might contain useful information sometimes and I wouldn't be
>> against it appearing hidden (in the buffer list). But being distracted by
>> this buffer in dired-mode is really unpleasant. If I only knew more emacs
>> lisp...
>>
>
>
> Let's see how it comes out in this case.
>
> Andreas
>
>> Cheers,
>>
>> Marius
>>




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to suppress/avoid *Async Shell Command* buffer?
  2013-05-18 13:58   ` Marius Hofert
@ 2013-05-18 14:33     ` Andreas Röhler
  2013-05-18 14:37       ` Marius Hofert
  2013-05-18 14:39     ` Hongxu Chen
  1 sibling, 1 reply; 14+ messages in thread
From: Andreas Röhler @ 2013-05-18 14:33 UTC (permalink / raw)
  To: Marius Hofert; +Cc: help-gnu-emacs

Am 18.05.2013 15:58, schrieb Marius Hofert:

>
>
Looks like caused by the question mark after okular

(("\\.\\(?:pdf\\|djvu\\|jp?g\\)\\'" "okular ? &")



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to suppress/avoid *Async Shell Command* buffer?
  2013-05-18 14:33     ` Andreas Röhler
@ 2013-05-18 14:37       ` Marius Hofert
  2013-05-18 17:13         ` Andreas Röhler
       [not found]         ` <mailman.41.1368897044.22516.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 14+ messages in thread
From: Marius Hofert @ 2013-05-18 14:37 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: help-gnu-emacs

Hi Andreas,

what do you mean by 'caused'?

The question mark is a place holder for the file (foo.pdf).
What does this have to do with *Async Shell Command* being opened?

Note: The behavior of "!" on foo.pdf in dired mode is fine (in the sense
that Okular opens, the pdf is shown, everything asynchronously), I just want
to avoid the buffer *Async Shell Command* being opened.

Let me know if anything isn't clear.

Cheers,

Marius



Andreas Röhler writes:

> Am 18.05.2013 15:58, schrieb Marius Hofert:
>
>>
>>
> Looks like caused by the question mark after okular
>
> (("\\.\\(?:pdf\\|djvu\\|jp?g\\)\\'" "okular ? &")




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to suppress/avoid *Async Shell Command* buffer?
  2013-05-18 13:58   ` Marius Hofert
  2013-05-18 14:33     ` Andreas Röhler
@ 2013-05-18 14:39     ` Hongxu Chen
  2013-05-18 18:52       ` Marius Hofert
  1 sibling, 1 reply; 14+ messages in thread
From: Hongxu Chen @ 2013-05-18 14:39 UTC (permalink / raw)
  To: Marius Hofert; +Cc: help-gnu-emacs


There is a tool called `openwith' that might meet your needs; you might
see this page for details:
http://www.emacswiki.org/emacs/OpenWith
It is available in elpa but I recommend that you customize the external
apps yourself.

Also Lee Xah has written a snippet for this issue, and you can just map
some key.
http://ergoemacs.org/emacs/emacs_dired_open_file_in_ext_apps.html

Hope these would be helpful.

Marius Hofert <marius.hofert@math.ethz.ch> writes:

> Andreas Röhler writes:
>
>> Am 18.05.2013 12:05, schrieb Marius Hofert:
>>> Hi Andreas,
>>>
>>> Thanks a lot for helping.
>>>
>>> The purpose is simply for opening them (asynchronously), viewing the pdf
>>
>> Hmm, probably don't understand yet, what is the difference WRT RET --dired-find-file-- ?
>
> dired-find-file opens it *in Emacs*. I can't edit it then and it's also
> a bit slow.
>
> I would like to open the file with *Okular* from Emacs.
>
>>
>>> (continuing to work in Emacs), (maybe add annotations to the pdf and save
>>> it).
>>>
>>
>> which would mean edit, not just view the pdf(?)
>
> yes.
>
> Maybe I wasn't clear. You can use "!" in dired mode to execute commands
> on the file at point. I use that to call Okular to open the file
> (in Okular; standalone). The same happens when I cd in the terminal to
> the directory containing the pdf file, then type 'okular foo.pdf &', but
> that's more tedious of course (also, it exits Okular if I quit the
> terminal -- which does not happen if I start it from dired-mode).
>
>>
>>
>>
>>> I use 'dired-mode' as 'file manager' and often would like to open and view
>>> pdfs in Okular. I also have other 'dired-guess-shell-alist-user' settings
>>> like opening pngs in eog or mp3s in VLC. But everytime I open a file, I get
>>> this annoying *Async Shell Command* buffer (either empty or with debug
>>> output) and I have to manually close it via C-x 0 etc. to get rid of it.
>>
>>
>> Please give an example of the shell-command used than.
>
> Due to my settings for dired-guess-shell-alist-user (as posted), I
> receive the suggestion 'okular ? &' when hitting '!' with the point on
> the pdf file. This executes "okular foo.pdf &" in the background (as far
> as I know), where 'foo.pdf' is the pdf file at point. Hitting RET starts
> Okular, opens foo.pdf (great), but also opens the *Async Shell Command*
> buffer in Emacs (as described; not so great).
>
> Cheers,
>
> Marius
>
>>
>>   I
>>> know that it might contain useful information sometimes and I wouldn't be
>>> against it appearing hidden (in the buffer list). But being distracted by
>>> this buffer in dired-mode is really unpleasant. If I only knew more emacs
>>> lisp...
>>>
>>
>>
>> Let's see how it comes out in this case.
>>
>> Andreas
>>
>>> Cheers,
>>>
>>> Marius
>>>
>
>

-- 
Regards,
Hongxu Chen



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to suppress/avoid *Async Shell Command* buffer?
  2013-05-18 14:37       ` Marius Hofert
@ 2013-05-18 17:13         ` Andreas Röhler
  2013-05-18 18:03           ` Marius Hofert
       [not found]         ` <mailman.41.1368897044.22516.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 14+ messages in thread
From: Andreas Röhler @ 2013-05-18 17:13 UTC (permalink / raw)
  To: Marius Hofert; +Cc: help-gnu-emacs

Am 18.05.2013 16:37, schrieb Marius Hofert:
> Hi Andreas,
>
> what do you mean by 'caused'?
>
> The question mark is a place holder for the file (foo.pdf).

Okay, see dired-do-shell-command reads it

> What does this have to do with *Async Shell Command* being opened?
>

Nothing. It's the ampersand following ? which matters.

> Note: The behavior of "!" on foo.pdf in dired mode is fine (in the sense
> that Okular opens, the pdf is shown, everything asynchronously), I just want
> to avoid the buffer *Async Shell Command* being opened.
>

Which seems the buffer Emacs connects the process to.
Deleting it should end the processes, probably not a good idea.

So the ampersand seems the culprit - not the question mark.
What happens when calling your stuff without it?

Andreas

> Let me know if anything isn't clear.
>
> Cheers,
>
> Marius
>
>
>
> Andreas Röhler writes:
>
>> Am 18.05.2013 15:58, schrieb Marius Hofert:
>>
>>>
>>>
>> Looks like caused by the question mark after okular
>>
>> (("\\.\\(?:pdf\\|djvu\\|jp?g\\)\\'" "okular ? &")
>
>




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to suppress/avoid *Async Shell Command* buffer?
       [not found]         ` <mailman.41.1368897044.22516.help-gnu-emacs@gnu.org>
@ 2013-05-18 17:48           ` Barry Margolin
  2013-05-18 21:19             ` Marius Hofert
  0 siblings, 1 reply; 14+ messages in thread
From: Barry Margolin @ 2013-05-18 17:48 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2111 bytes --]

In article <mailman.41.1368897044.22516.help-gnu-emacs@gnu.org>,
 Andreas Röhler <andreas.roehler@easy-emacs.de> wrote:

> Am 18.05.2013 16:37, schrieb Marius Hofert:
> > Hi Andreas,
> >
> > what do you mean by 'caused'?
> >
> > The question mark is a place holder for the file (foo.pdf).
> 
> Okay, see dired-do-shell-command reads it
> 
> > What does this have to do with *Async Shell Command* being opened?
> >
> 
> Nothing. It's the ampersand following ? which matters.
> 
> > Note: The behavior of "!" on foo.pdf in dired mode is fine (in the sense
> > that Okular opens, the pdf is shown, everything asynchronously), I just want
> > to avoid the buffer *Async Shell Command* being opened.
> >
> 
> Which seems the buffer Emacs connects the process to.
> Deleting it should end the processes, probably not a good idea.
> 
> So the ampersand seems the culprit - not the question mark.
> What happens when calling your stuff without it?

This is essentially the same as using M-!, isn't it, except that it 
automatically fills in the filename argument? If you don't use the 
ampersand, Emacs waits for the command to finish, and then displays the 
output in *Shell Command Output*. If you use ampersand, it doesn't wait, 
and displays the output incrementally in *Async Shell Command*.

Either way, the output has to be put somewhere.

However, the synchronous mode has a feature: if the command produces 
little or no output, it doesn't switch to the *Shell Command Output* 
buffer, it just displays it in the minibuffer.  Here's a trick that I 
think should do what you want: Run the backgrounded command in a 
subshell (wrap it in parentheses):

! (command ? &>/dev/null &)

As far as Emacs is concerned, that's a synchronous command, because it 
doesn't end in "&". But it runs in the background within the subshell. 
Redirect the output so that Emacs immediately reads EOF, and has nothing 
to display in the minibuffer (it may display "(Shell command completed 
with no output)").

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to suppress/avoid *Async Shell Command* buffer?
  2013-05-18 17:13         ` Andreas Röhler
@ 2013-05-18 18:03           ` Marius Hofert
  2013-05-18 18:58             ` Andreas Röhler
  0 siblings, 1 reply; 14+ messages in thread
From: Marius Hofert @ 2013-05-18 18:03 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: help-gnu-emacs


Andreas Röhler writes:

> Am 18.05.2013 16:37, schrieb Marius Hofert:
>> Hi Andreas,
>>
>> what do you mean by 'caused'?
>>
>> The question mark is a place holder for the file (foo.pdf).
>
> Okay, see dired-do-shell-command reads it
>
>> What does this have to do with *Async Shell Command* being opened?
>>
>
> Nothing. It's the ampersand following ? which matters.

Yes, this runs the command *asynchronously* (that's where the name of
the annoying buffer comes from).

If not run asynchronously (i.e., if run without ampersand), emacs is
blocked. Also, closing emacs closes the external application, too. Both
behaviors I find strange / are undesirable.

>
>> Note: The behavior of "!" on foo.pdf in dired mode is fine (in the sense
>> that Okular opens, the pdf is shown, everything asynchronously), I just want
>> to avoid the buffer *Async Shell Command* being opened.
>>
>
> Which seems the buffer Emacs connects the process to.
> Deleting it should end the processes, probably not a good idea.

When run asynchronously, closing emacs does *not* close the external
application. I like this behavior very much.

>
>
> So the ampersand seems the culprit - not the question mark.
> What happens when calling your stuff without it?

Then no buffer is open (which was clear since the command is not run
asynchronously). The question is how to avoid the buffer being opened
*when* using the command asynchronously.

I currently do some testing with the suggestions of Hongxu. I reply later.

Cheers,

Marius

>
>
> Andreas
>
>> Let me know if anything isn't clear.
>>
>> Cheers,
>>
>> Marius
>>
>>
>>
>> Andreas Röhler writes:
>>
>>> Am 18.05.2013 15:58, schrieb Marius Hofert:
>>>
>>>>
>>>>
>>> Looks like caused by the question mark after okular
>>>
>>> (("\\.\\(?:pdf\\|djvu\\|jp?g\\)\\'" "okular ? &")
>>
>>




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to suppress/avoid *Async Shell Command* buffer?
  2013-05-18 14:39     ` Hongxu Chen
@ 2013-05-18 18:52       ` Marius Hofert
  0 siblings, 0 replies; 14+ messages in thread
From: Marius Hofert @ 2013-05-18 18:52 UTC (permalink / raw)
  To: Hongxu Chen; +Cc: help-gnu-emacs


Hongxu Chen writes:

> There is a tool called `openwith' that might meet your needs; you might
> see this page for details:
> http://www.emacswiki.org/emacs/OpenWith
> It is available in elpa but I recommend that you customize the external
> apps yourself.
>
> Also Lee Xah has written a snippet for this issue, and you can just map
> some key.
> http://ergoemacs.org/emacs/emacs_dired_open_file_in_ext_apps.html

This is indeed interesting, thanks a lot. Both approaches use
'start-process' (which seems good). The approach by Lee seems to be
fine. It calls xdg-open.

I tried with "!" -> "xdg-open ?" and it opens foo.pdf externally (in a
persistent way), but emacs is blocked. However, when I use 'xdg-open ?
&' then *Messages* says "xdg-open rank.pdf: finished." but nothing is
opened. ... Do you know why?  Was just wondering...

>
> Hope these would be helpful.

Indeed, many thanks!

Cheers,

Marius

>
>
> Marius Hofert <marius.hofert@math.ethz.ch> writes:
>
>> Andreas Röhler writes:
>>
>>> Am 18.05.2013 12:05, schrieb Marius Hofert:
>>>> Hi Andreas,
>>>>
>>>> Thanks a lot for helping.
>>>>
>>>> The purpose is simply for opening them (asynchronously), viewing the pdf
>>>
>>> Hmm, probably don't understand yet, what is the difference WRT RET --dired-find-file-- ?
>>
>> dired-find-file opens it *in Emacs*. I can't edit it then and it's also
>> a bit slow.
>>
>> I would like to open the file with *Okular* from Emacs.
>>
>>>
>>>> (continuing to work in Emacs), (maybe add annotations to the pdf and save
>>>> it).
>>>>
>>>
>>> which would mean edit, not just view the pdf(?)
>>
>> yes.
>>
>> Maybe I wasn't clear. You can use "!" in dired mode to execute commands
>> on the file at point. I use that to call Okular to open the file
>> (in Okular; standalone). The same happens when I cd in the terminal to
>> the directory containing the pdf file, then type 'okular foo.pdf &', but
>> that's more tedious of course (also, it exits Okular if I quit the
>> terminal -- which does not happen if I start it from dired-mode).
>>
>>>
>>>
>>>
>>>> I use 'dired-mode' as 'file manager' and often would like to open and view
>>>> pdfs in Okular. I also have other 'dired-guess-shell-alist-user' settings
>>>> like opening pngs in eog or mp3s in VLC. But everytime I open a file, I get
>>>> this annoying *Async Shell Command* buffer (either empty or with debug
>>>> output) and I have to manually close it via C-x 0 etc. to get rid of it.
>>>
>>>
>>> Please give an example of the shell-command used than.
>>
>> Due to my settings for dired-guess-shell-alist-user (as posted), I
>> receive the suggestion 'okular ? &' when hitting '!' with the point on
>> the pdf file. This executes "okular foo.pdf &" in the background (as far
>> as I know), where 'foo.pdf' is the pdf file at point. Hitting RET starts
>> Okular, opens foo.pdf (great), but also opens the *Async Shell Command*
>> buffer in Emacs (as described; not so great).
>>
>> Cheers,
>>
>> Marius
>>
>>>
>>>   I
>>>> know that it might contain useful information sometimes and I wouldn't be
>>>> against it appearing hidden (in the buffer list). But being distracted by
>>>> this buffer in dired-mode is really unpleasant. If I only knew more emacs
>>>> lisp...
>>>>
>>>
>>>
>>> Let's see how it comes out in this case.
>>>
>>> Andreas
>>>
>>>> Cheers,
>>>>
>>>> Marius
>>>>
>>
>>



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to suppress/avoid *Async Shell Command* buffer?
  2013-05-18 18:03           ` Marius Hofert
@ 2013-05-18 18:58             ` Andreas Röhler
  0 siblings, 0 replies; 14+ messages in thread
From: Andreas Röhler @ 2013-05-18 18:58 UTC (permalink / raw)
  To: Marius Hofert; +Cc: help-gnu-emacs

Am 18.05.2013 20:03, schrieb Marius Hofert:
>
[ ... ]
>
> I currently do some testing with the suggestions of Hongxu. I reply later.
>
> Cheers,
>
> Marius
>

In case you didn't find a solution already, setting

file-name-handler-alist

might open a way to solve it. I.e. it's about to pass a process-buffer name differently from the hard-coded one you don't want to see.

Andreas



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to suppress/avoid *Async Shell Command* buffer?
  2013-05-18 17:48           ` Barry Margolin
@ 2013-05-18 21:19             ` Marius Hofert
  0 siblings, 0 replies; 14+ messages in thread
From: Marius Hofert @ 2013-05-18 21:19 UTC (permalink / raw)
  To: Barry Margolin; +Cc: help-gnu-emacs


Barry Margolin writes:

> In article <mailman.41.1368897044.22516.help-gnu-emacs@gnu.org>,
>  Andreas Röhler <andreas.roehler@easy-emacs.de> wrote:
>
>> Am 18.05.2013 16:37, schrieb Marius Hofert:
>> > Hi Andreas,
>> >
>> > what do you mean by 'caused'?
>> >
>> > The question mark is a place holder for the file (foo.pdf).
>>
>> Okay, see dired-do-shell-command reads it
>>
>> > What does this have to do with *Async Shell Command* being opened?
>> >
>>
>> Nothing. It's the ampersand following ? which matters.
>>
>> > Note: The behavior of "!" on foo.pdf in dired mode is fine (in the sense
>> > that Okular opens, the pdf is shown, everything asynchronously), I just want
>> > to avoid the buffer *Async Shell Command* being opened.
>> >
>>
>> Which seems the buffer Emacs connects the process to.
>> Deleting it should end the processes, probably not a good idea.
>>
>> So the ampersand seems the culprit - not the question mark.
>> What happens when calling your stuff without it?
>
> This is essentially the same as using M-!, isn't it, except that it
> automatically fills in the filename argument? If you don't use the
> ampersand, Emacs waits for the command to finish, and then displays the
> output in *Shell Command Output*. If you use ampersand, it doesn't wait,
> and displays the output incrementally in *Async Shell Command*.
>
> Either way, the output has to be put somewhere.
>
> However, the synchronous mode has a feature: if the command produces
> little or no output, it doesn't switch to the *Shell Command Output*
> buffer, it just displays it in the minibuffer.  Here's a trick that I
> think should do what you want: Run the backgrounded command in a
> subshell (wrap it in parentheses):
>
> ! (command ? &>/dev/null &)

indeed, this also works, very nice!

Thanks, Barry.

Cheers,

Marius

>
>
> As far as Emacs is concerned, that's a synchronous command, because it
> doesn't end in "&". But it runs in the background within the subshell.
> Redirect the output so that Emacs immediately reads EOF, and has nothing
> to display in the minibuffer (it may display "(Shell command completed
> with no output)").



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-05-18 21:19 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-18 10:05 How to suppress/avoid *Async Shell Command* buffer? Marius Hofert
2013-05-18 12:47 ` Andreas Röhler
2013-05-18 13:58   ` Marius Hofert
2013-05-18 14:33     ` Andreas Röhler
2013-05-18 14:37       ` Marius Hofert
2013-05-18 17:13         ` Andreas Röhler
2013-05-18 18:03           ` Marius Hofert
2013-05-18 18:58             ` Andreas Röhler
     [not found]         ` <mailman.41.1368897044.22516.help-gnu-emacs@gnu.org>
2013-05-18 17:48           ` Barry Margolin
2013-05-18 21:19             ` Marius Hofert
2013-05-18 14:39     ` Hongxu Chen
2013-05-18 18:52       ` Marius Hofert
  -- strict thread matches above, loose matches on Subject: below --
2013-05-18  0:03 Marius Hofert
2013-05-18  8:48 ` Andreas Röhler

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