mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-04 11:40:22 +00:00
(dired-guess-shell-command): Put all guesses to the
minibuffer default value list instead of pushing them temporarily to the history list.
This commit is contained in:
parent
fb30dfd235
commit
5420b51477
@ -3,6 +3,10 @@
|
|||||||
* simple.el (goto-history-element): Allow minibuffer-default to be
|
* simple.el (goto-history-element): Allow minibuffer-default to be
|
||||||
a list of default values accessible by typing M-n in the minibuffer.
|
a list of default values accessible by typing M-n in the minibuffer.
|
||||||
|
|
||||||
|
* dired-x.el (dired-guess-shell-command): Put all guesses to the
|
||||||
|
minibuffer default value list instead of pushing them temporarily
|
||||||
|
to the history list.
|
||||||
|
|
||||||
2007-10-21 Stefan Monnier <monnier@iro.umontreal.ca>
|
2007-10-21 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||||
|
|
||||||
* emacs-lisp/byte-opt.el (byte-optimize-featurep): Fix paren typo.
|
* emacs-lisp/byte-opt.el (byte-optimize-featurep): Fix paren typo.
|
||||||
|
@ -1172,56 +1172,28 @@ See `dired-guess-shell-alist-user'."
|
|||||||
|
|
||||||
(defun dired-guess-shell-command (prompt files)
|
(defun dired-guess-shell-command (prompt files)
|
||||||
"Ask user with PROMPT for a shell command, guessing a default from FILES."
|
"Ask user with PROMPT for a shell command, guessing a default from FILES."
|
||||||
|
|
||||||
(let ((default (dired-guess-default files))
|
(let ((default (dired-guess-default files))
|
||||||
default-list old-history val (failed t))
|
default-list val)
|
||||||
|
|
||||||
(if (null default)
|
(if (null default)
|
||||||
;; Nothing to guess
|
;; Nothing to guess
|
||||||
(read-from-minibuffer prompt nil nil nil 'dired-shell-command-history)
|
(read-from-minibuffer prompt nil nil nil 'dired-shell-command-history)
|
||||||
|
|
||||||
;; Save current history list
|
|
||||||
(setq old-history dired-shell-command-history)
|
|
||||||
|
|
||||||
(if (listp default)
|
(if (listp default)
|
||||||
|
|
||||||
;; More than one guess
|
;; More than one guess
|
||||||
(setq default-list default
|
(setq default-list default
|
||||||
default (car default)
|
default (car default)
|
||||||
prompt (concat
|
prompt (concat
|
||||||
prompt
|
prompt
|
||||||
(format "{%d guesses} " (length default-list))))
|
(format "{%d guesses} " (length default-list))))
|
||||||
|
|
||||||
;; Just one guess
|
;; Just one guess
|
||||||
(setq default-list (list default)))
|
(setq default-list (list default)))
|
||||||
|
;; Put the first guess in the prompt but not in the initial value.
|
||||||
;; Push all guesses onto history so that they can be retrieved with M-p
|
(setq prompt (concat prompt (format "[%s] " default)))
|
||||||
;; and put the first guess in the prompt but not in the initial value.
|
;; All guesses can be retrieved with M-n
|
||||||
(setq dired-shell-command-history
|
(setq val (read-from-minibuffer prompt nil nil nil
|
||||||
(append default-list dired-shell-command-history)
|
'dired-shell-command-history
|
||||||
prompt (concat prompt (format "[%s] " default)))
|
default-list))
|
||||||
|
;; If we got a return, then return default.
|
||||||
;; The unwind-protect returns VAL, and we too.
|
(if (equal val "") default val))))
|
||||||
(unwind-protect
|
|
||||||
;; BODYFORM
|
|
||||||
(progn
|
|
||||||
(setq val (read-from-minibuffer prompt nil nil nil
|
|
||||||
'dired-shell-command-history)
|
|
||||||
failed nil)
|
|
||||||
;; If we got a return, then use default.
|
|
||||||
(if (equal val "")
|
|
||||||
(setq val default))
|
|
||||||
val)
|
|
||||||
|
|
||||||
;; UNWINDFORMS
|
|
||||||
;; Undo pushing onto the history list so that an aborted
|
|
||||||
;; command doesn't get the default in the next command.
|
|
||||||
(setq dired-shell-command-history old-history)
|
|
||||||
(if (not failed)
|
|
||||||
(or (equal val (car-safe dired-shell-command-history))
|
|
||||||
(setq dired-shell-command-history
|
|
||||||
(cons val dired-shell-command-history))))))))
|
|
||||||
|
|
||||||
|
|
||||||
;;; REDEFINE.
|
;;; REDEFINE.
|
||||||
;;; Redefine dired-aux.el's version:
|
;;; Redefine dired-aux.el's version:
|
||||||
|
Loading…
Reference in New Issue
Block a user