GNU bug report logs -
#11815
24.1; Confusing behavior of & in Dired
Previous Next
Reported by: "John Wiegley" <johnw <at> newartisans.com>
Date: Fri, 29 Jun 2012 08:37:01 UTC
Severity: normal
Merged with 10598
Found in versions 24.0.92, 24.1
Done: Juri Linkov <juri <at> jurta.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> I think that the following equivalence should hold:
>
> ! COMMAND & == & COMMAND
The problem is that the equivalence should be rather following:
& COMMAND == ! COMMAND * &
because the file names should be stuffed before the ampersand.
And also:
& COMMAND * == ! COMMAND * &
& COMMAND * ARG2 == ! COMMAND * ARG2 &
A reliable fix consistent with the usage of `*' and `?' would be:
=== modified file 'lisp/dired-aux.el'
--- lisp/dired-aux.el 2012-04-17 01:52:00 +0000
+++ lisp/dired-aux.el 2012-07-11 09:11:48 +0000
@@ -556,8 +556,9 @@ (defun dired-do-async-shell-command (com
(dired-read-shell-command "& on %s: " current-prefix-arg files)
current-prefix-arg
files)))
- (unless (string-match "[*?][ \t]*\\'" command)
- (setq command (concat command " *")))
+ (if (and (not (string-match dired-quark-subst-regexp command))
+ (not (string-match dired-star-subst-regexp command)))
+ (setq command (concat command " *")))
(unless (string-match "&[ \t]*\\'" command)
(setq command (concat command " &")))
(dired-do-shell-command command arg file-list))
But then what to do with `?'?
& COMMAND ? == ! COMMAND FILE1 & COMMAND FILE2 &
or
& COMMAND ? == ! COMMAND FILE1 ; COMMAND FILE2 &
This is why we have bug#10598.
The following comment in dired-aux.el provides a useful hint
about the history of this function:
;; The in-background argument is only needed in Emacs 18 where
;; shell-command doesn't understand an appended ampersand `&'.
`in-background' is the former argument of `dired-do-shell-command'
removed by revno 911. It could be revived, but its drawback is that
this argument should be added to many functions.
This bug report was last modified 12 years and 313 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.