Subject: bug#10598: 24.0.92; run dired-do-async-shell-command on multiple files individually

From: Jérémy Compostella <[email-masked]>
Date: Wed, 25 Jan 2012 23:48:51 +0100

Hi,

This bug was really annoying me tonight so I wrote the attached patch
which fix it by translating `gv foo.ps&;gv bar.ps&' to `gv foo.ps&gv
bar.ps&'.

I do agree it should be better to provide a way to choice between the
sequential or parallel solution but I have no idea how to implement it
in a clean fashion for now.

Anyway, the current behavior looks buggy and I propose to merge the
attached patch in a first time in order to have a acceptable behavior
that is far better than an error.

Best regards,

Jérémy

>From aefc85c364f6e51676ffc9dc44deb9a4d43a128c Mon Sep 17 00:00:00 2001
From: Jeremy Compostella <[email-masked]>
Date: Wed, 25 Jan 2012 23:38:54 +0100
Subject: [PATCH] Fix dired-do-async-shell-command on multiple files individually (bug#10598)

The `dired-shell-stuff-it' should not insert the ";" shell command
separator when called with a command argument ending with the "&"
character.

Signed-off-by: Jeremy Compostella <[email-masked]>
---
 lisp/dired-aux.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 2d05be3..74f0de9 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -659,7 +659,8 @@ can be produced by `dired-get-marked-files', for example."
 		 retval))
 	   (lambda (x) (concat command dired-mark-separator x)))))
     (if on-each
-	(mapconcat stuff-it (mapcar 'shell-quote-argument file-list) ";")
+	(mapconcat stuff-it (mapcar 'shell-quote-argument file-list)
+		   (if (string-match "[ \t]*&[ \t]*\\'" command) "" ";"))
       (let ((files (mapconcat 'shell-quote-argument
 			      file-list dired-mark-separator)))
 	(if (> (length file-list) 1)
-- 
1.7.2.5