From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Clemente Newsgroups: gmane.emacs.devel Subject: & and M-& to run programs asynchronously (was: Re: Short explanation for & in key ! of dired) Date: Thu, 03 Jul 2008 13:34:53 +0200 Message-ID: <873amryzdu.fsf_-_@gmail.com> References: <87hcbkpo0e.fsf@gmail.com> <86y74wzeq1.fsf@lola.quinscape.zz> <874p7ifonh.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1215084917 30843 80.91.229.12 (3 Jul 2008 11:35:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Jul 2008 11:35:17 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 03 13:36:03 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KEN6Y-0002Jw-AK for ged-emacs-devel@m.gmane.org; Thu, 03 Jul 2008 13:36:02 +0200 Original-Received: from localhost ([127.0.0.1]:42527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KEN5h-0008Rz-Jb for ged-emacs-devel@m.gmane.org; Thu, 03 Jul 2008 07:35:09 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KEN5c-0008Rk-IF for emacs-devel@gnu.org; Thu, 03 Jul 2008 07:35:04 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KEN5a-0008Qn-Tx for emacs-devel@gnu.org; Thu, 03 Jul 2008 07:35:03 -0400 Original-Received: from [199.232.76.173] (port=59953 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KEN5a-0008Qd-Kj for emacs-devel@gnu.org; Thu, 03 Jul 2008 07:35:02 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:40425 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KEN5a-0005dm-DX for emacs-devel@gnu.org; Thu, 03 Jul 2008 07:35:02 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KEN5X-0005uN-49 for emacs-devel@gnu.org; Thu, 03 Jul 2008 11:34:59 +0000 Original-Received: from 62.97.110.250 ([62.97.110.250]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 03 Jul 2008 11:34:59 +0000 Original-Received: from dcl441-bugs by 62.97.110.250 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 03 Jul 2008 11:34:59 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 56 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 62.97.110.250 User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) Cancel-Lock: sha1:oZSNDuc86lSFu+cjJPTprAXq054= X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:100293 Archived-At: What's the status of this feature? Several problems were tackled and several suggestions were proposed, but no consensus was reached. Discussion brought following topics: - & in dired is not intuitive for dired-flag-garbage-files - & in dired could be used to open in background a command which affects the selected file. Ex: & gimp RET - M-& could be like M-! but opening the program asynchronously (in background) - M-! or M-& use always the same buffer to show their output. This can be confusing - C-u M-! or C-u M-& could be used to create a new buffer for the output - C-u M-! or C-u M-& could be used to discard output - M-& could dissociate the started commands so they persist after killing Emacs - M-! with a & at the end could have a different behaviour than M-&: M-& to dissociate commands, M-! & to not do it - the current behaviour of backgrounding seems anachronistic since nowadays it's very normal to open graphical programs which show no output and need to stay in background - sometimes the output of a command is needed, even of a graphical command - we could have a flag to redirect stdout to stderr, and show only stdout - we could redirect stdout to a temporary file, for instance in /tmp, and delete it when Emacs quits - we could offer to see the output each time that a background program which produced output ends - we could redirect all output to a temporary buffer like *Messages* - stdout/stderr should be somehow distinguished (faces, ...) - a variable could decide if the output is needed, and C-u could negate this setting - if we use a different output buffer for each program, old buffers (of ended programs) could be reused It was spoken about different use cases. I have seen 4 of them: | | UC1 | UC2 | UC3 | UC4 | |--------------------------------+-----+-----+-----+-----| | Execute in background? | | t | t | t | | Output visible? | t | | t | t | | New buffer for each & command? | | | | t | Examples: - UC1: M-! date. Note that when run in foreground, output will always be displayed, and only one buffer will be used - UC2: ...M-& gimp. (You need no output) - UC3: ...M-& glxgears. (It displays output to stdout) - UC4: ...M-& bzr up, and then M-& svn up. (You need different outputs) Some switches are needed to select the desired behaviour. Following options were suggested: - a variable - C-u - a question after the command has ended Places to store the output in: - a buffer like *Messages* - a temporary file Note that there are different commands to enhance: - & in dired - M-& in the global map - and the documentation! -- Daniel