Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple asynchronous shell-commands in Emacs-Dired?

Emacs obviously can handle multiple asynchronous sub-processes, otherwise a multi-language programming environment like org-babel, to give an example, wouldn't be possible.

However, when I'm in Dired and start an asynchronous shell command to view a pdf file (& evince), and then try to do the same on a second pdf file, I get the following message:

"A command is running - kill it? Yes or No?"

Is there a way to run several asynchronous shell commands in parallel, when in Dired?

like image 723
Thorsten Avatar asked Aug 01 '11 07:08

Thorsten


2 Answers

When you use dired-do-async-shell-command Emacs create a *Async Shell Command* buffer. If you want another async command you need to rename this buffer, for example using M-x rename-uniquely

you could try to change the comportment of dired-do-async-shell-command by advising it:

 (defadvice shell-command (after shell-in-new-buffer (command &optional output-buffer error-buffer))
    (when (get-buffer "*Async Shell Command*")
      (with-current-buffer "*Async Shell Command*"
         (rename-uniquely))))
 (ad-activate 'shell-command)

note that I really advice the shell-command Emacs command because it's called by dired.

like image 198
Rémi Avatar answered Oct 26 '22 15:10

Rémi


I don't think it's possible with dired-do-async-shell-command, but if you just want to open some file is certain external application I suggest using OpenWith, which allows any number of external processes running.

like image 21
Victor Deryagin Avatar answered Oct 26 '22 14:10

Victor Deryagin