aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorTino Calancha2017-07-02 22:09:02 +0900
committerTino Calancha2017-07-02 22:09:02 +0900
commita8b71b3dc53883a2dcb3339bf4c7e1232c42d276 (patch)
treefd9972fc07854be2f6e26f10e4d51b94ffc5381e /doc
parent80e200c0a08805771d1c709546d79088be188021 (diff)
downloademacs-a8b71b3dc53883a2dcb3339bf4c7e1232c42d276.tar.gz
emacs-a8b71b3dc53883a2dcb3339bf4c7e1232c42d276.zip
Extend dired-do-shell-command substitutions
Substitute "`?`" inside command with the current file name. See details in: https://lists.gnu.org/archive/html/emacs-devel/2017-06/msg00618.html * lisp/dired-aux.el (dired-quark-subst-regexp, dired-star-subst-regexp): Mark as obsolete. (dired-isolated-string-re): New defun. (dired--star-or-qmark-p): New predicate. (dired-do-shell-command): Use dired--star-or-qmark-p. Substitute "`?`" with the current file name. * doc/emacs/dired.texi (Shell Commands in Dired): Update manual. ; * etc/NEWS: Mention it.
Diffstat (limited to 'doc')
-rw-r--r--doc/emacs/dired.texi26
1 files changed, 16 insertions, 10 deletions
diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index 22b0fcd4676..28cb51d88bb 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -875,27 +875,33 @@ treat it specially.
875 875
876@item 876@item
877Otherwise, if the command string contains @samp{?} surrounded by 877Otherwise, if the command string contains @samp{?} surrounded by
878whitespace, Emacs runs the shell command once @emph{for each file}, 878whitespace or @samp{`?`}, Emacs runs the shell command once
879substituting the current file name for @samp{?} each time. You can 879@emph{for each file}, substituting the current file name for @samp{?}
880use @samp{?} more than once in the command; the same file name 880and @samp{`?`} each time. You can use both @samp{?} or @samp{`?`} more
881replaces each occurrence. 881than once in the command; the same file name replaces each occurrence.
882If you mix them with @samp{*} the command signals an error.
882 883
883@item 884@item
884If the command string contains neither @samp{*} nor @samp{?}, Emacs 885If the command string contains neither @samp{*} nor @samp{?} nor @samp{`?`},
885runs the shell command once for each file, adding the file name at the 886Emacs runs the shell command once for each file, adding the file name at the
886end. For example, @kbd{! uudecode @key{RET}} runs @code{uudecode} on 887end. For example, @kbd{! uudecode @key{RET}} runs @code{uudecode} on
887each file. 888each file.
888@end itemize 889@end itemize
889 890
890 To iterate over the file names in a more complicated fashion, use an 891 To iterate over the file names in a more complicated fashion, you might
891explicit shell loop. For example, here is how to uuencode each file, 892prefer to use an explicit shell loop. For example, here is how to uuencode
892making the output file name by appending @samp{.uu} to the input file 893each file, making the output file name by appending @samp{.uu} to the input
893name: 894file name:
894 895
895@example 896@example
896for file in * ; do uuencode "$file" "$file" >"$file".uu; done 897for file in * ; do uuencode "$file" "$file" >"$file".uu; done
897@end example 898@end example
898 899
900The same example with @samp{`?`} notation:
901@example
902uuencode ? ? > `?`.uu
903@end example
904
899 The @kbd{!} and @kbd{&} commands do not attempt to update the Dired 905 The @kbd{!} and @kbd{&} commands do not attempt to update the Dired
900buffer to show new or modified files, because they don't know what 906buffer to show new or modified files, because they don't know what
901files will be changed. Use the @kbd{g} command to update the Dired 907files will be changed. Use the @kbd{g} command to update the Dired