[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#11815: 24.1; Confusing behavior of & in Dired
From: |
Juri Linkov |
Subject: |
bug#11815: 24.1; Confusing behavior of & in Dired |
Date: |
Wed, 11 Jul 2012 12:21:23 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu) |
> 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.
- bug#11815: 24.1; Confusing behavior of & in Dired,
Juri Linkov <=