emacs-devel
[Top][All Lists]
Advanced

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

& and M-& to run programs asynchronously (was: Re: Short explanation for


From: Daniel Clemente
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
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)


  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





reply via email to

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