Function: dired-read-shell-command

dired-read-shell-command is a byte-compiled function defined in dired-aux.el.gz.

Signature

(dired-read-shell-command PROMPT ARG FILES)

Documentation

Read a dired shell command.

PROMPT should be a format string with one "%s" format sequence, which is replaced by the value returned by dired-mark-prompt, with ARG and FILES as its arguments. FILES should be a list of file names. The result is used as the prompt.

This normally reads using read-shell-command, but if the dired-x package is loaded, use dired-guess-shell-command to offer a smarter default choice of shell command.

Source Code

;; Defined in /usr/src/emacs/lisp/dired-aux.el.gz
;; This is an extra function so that you can redefine it, e.g., to use gmhist.
(defun dired-read-shell-command (prompt arg files)
  "Read a dired shell command.
PROMPT should be a format string with one \"%s\" format sequence,
which is replaced by the value returned by `dired-mark-prompt',
with ARG and FILES as its arguments.  FILES should be a list of
file names.  The result is used as the prompt.

This normally reads using `read-shell-command', but if the
`dired-x' package is loaded, use `dired-guess-shell-command' to
offer a smarter default choice of shell command."
  (minibuffer-with-setup-hook
      (lambda ()
	(setq-local dired-aux-files files)
	(setq-local minibuffer-default-add-function
		    #'minibuffer-default-add-dired-shell-commands))
    (setq prompt (format prompt (dired-mark-prompt arg files)))
    (if (functionp 'dired-guess-shell-command)
	(dired-mark-pop-up nil 'shell files
			   'dired-guess-shell-command prompt files)
      (dired-mark-pop-up nil 'shell files
			 'read-shell-command prompt nil nil))))