From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: How to suppress/avoid *Async Shell Command* buffer? Date: Sat, 18 May 2013 13:48:15 -0400 Organization: A noiseless patient Spider Message-ID: References: <5197784A.1020500@easy-emacs.de> <87sj1ktmnq.fsf@math.ethz.ch> <5197913E.1010702@easy-emacs.de> <87mwrstku1.fsf@math.ethz.ch> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1368907924 16772 80.91.229.3 (18 May 2013 20:12:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 May 2013 20:12:04 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat May 18 22:12:04 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UdnU3-0003Sx-TO for geh-help-gnu-emacs@m.gmane.org; Sat, 18 May 2013 22:12:04 +0200 Original-Received: from localhost ([::1]:44514 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdnU2-0002LB-U3 for geh-help-gnu-emacs@m.gmane.org; Sat, 18 May 2013 16:12:02 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!barmar.motzarella.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 54 Injection-Info: barmar.motzarella.org; posting-host="2be9e9f5dd9af768b8861af71b85fc28"; logging-data="2517"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bwWcI26MJZAf/SOg4pBWI" User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Cancel-Lock: sha1:9w4ipRfGgweF0BpGXJz4UHcrKWg= Original-Xref: usenet.stanford.edu gnu.emacs.help:198641 X-Mailman-Approved-At: Sat, 18 May 2013 16:11:54 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:90909 Archived-At: In article , Andreas Röhler 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 ***