Function: dired-guess-shell-command
dired-guess-shell-command is an autoloaded and byte-compiled function
defined in dired-aux.el.gz.
Signature
(dired-guess-shell-command PROMPT FILES)
Documentation
Ask user with PROMPT for a shell command, guessing a default from FILES.
Probably introduced at or before Emacs version 29.1.
Source Code
;; Defined in /usr/src/emacs/lisp/dired-aux.el.gz
;;;###autoload
(defun dired-guess-shell-command (prompt files)
"Ask user with PROMPT for a shell command, guessing a default from FILES."
(let ((default (shell-command-guess files))
default-list val)
(if (null default)
;; Nothing to guess
(read-shell-command prompt nil 'dired-shell-command-history)
(setq prompt (replace-regexp-in-string ": $" " " prompt))
(if (listp default)
;; More than one guess
(setq default-list default
default (car default)
prompt (concat
prompt
(format "{%d guesses} " (length default-list))))
;; Just one guess
(setq default-list (list default)))
;; Put the first guess in the prompt but not in the initial value.
(setq prompt (concat prompt (format "[%s]: " default)))
;; All guesses can be retrieved with M-n
(setq val (read-shell-command prompt nil
'dired-shell-command-history
default-list))
;; If we got a return, then return default.
(if (equal val "") default val))))