diff options
| author | Juri Linkov | 2009-02-22 23:36:46 +0000 |
|---|---|---|
| committer | Juri Linkov | 2009-02-22 23:36:46 +0000 |
| commit | c521381a6cb6fc03358a2e2a3a15ddceea0272ec (patch) | |
| tree | 19ff2128567f1781b0f2b0fae6db5003a00417b7 | |
| parent | bfb108d0fd6d9ddb408c578a8c3ee90767b4b2c9 (diff) | |
| download | emacs-c521381a6cb6fc03358a2e2a3a15ddceea0272ec.tar.gz emacs-c521381a6cb6fc03358a2e2a3a15ddceea0272ec.zip | |
(dired-guess-shell-command): Use read-shell-command
instead of read-from-minibuffer.
(dired-read-shell-command): Add code that uses
minibuffer-with-setup-hook to set minibuffer-default-add-function
to minibuffer-default-add-dired-shell-commands exactly like
`dired-read-shell-command' in dired-aux.el already does. Doc fix.
| -rw-r--r-- | lisp/dired-x.el | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 9570ecda71f..4b80ff86ce8 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el | |||
| @@ -1187,7 +1187,7 @@ See `dired-guess-shell-alist-user'." | |||
| 1187 | default-list val) | 1187 | default-list val) |
| 1188 | (if (null default) | 1188 | (if (null default) |
| 1189 | ;; Nothing to guess | 1189 | ;; Nothing to guess |
| 1190 | (read-from-minibuffer prompt nil nil nil 'dired-shell-command-history) | 1190 | (read-shell-command prompt nil 'dired-shell-command-history) |
| 1191 | (if (listp default) | 1191 | (if (listp default) |
| 1192 | ;; More than one guess | 1192 | ;; More than one guess |
| 1193 | (setq default-list default | 1193 | (setq default-list default |
| @@ -1200,24 +1200,28 @@ See `dired-guess-shell-alist-user'." | |||
| 1200 | ;; Put the first guess in the prompt but not in the initial value. | 1200 | ;; Put the first guess in the prompt but not in the initial value. |
| 1201 | (setq prompt (concat prompt (format "[%s] " default))) | 1201 | (setq prompt (concat prompt (format "[%s] " default))) |
| 1202 | ;; All guesses can be retrieved with M-n | 1202 | ;; All guesses can be retrieved with M-n |
| 1203 | (setq val (read-from-minibuffer prompt nil nil nil | 1203 | (setq val (read-shell-command prompt nil |
| 1204 | 'dired-shell-command-history | 1204 | 'dired-shell-command-history |
| 1205 | default-list)) | 1205 | default-list)) |
| 1206 | ;; If we got a return, then return default. | 1206 | ;; If we got a return, then return default. |
| 1207 | (if (equal val "") default val)))) | 1207 | (if (equal val "") default val)))) |
| 1208 | 1208 | ||
| 1209 | ;; REDEFINE. | 1209 | ;; REDEFINE. |
| 1210 | ;; Redefine dired-aux.el's version: | 1210 | ;; Redefine dired-aux.el's version: |
| 1211 | (defun dired-read-shell-command (prompt arg files) | 1211 | (defun dired-read-shell-command (prompt arg files) |
| 1212 | "Read a dired shell command prompting with PROMPT (using read-string). | 1212 | "Read a dired shell command prompting with PROMPT (using read-shell-command). |
| 1213 | ARG is the prefix arg and may be used to indicate in the prompt which | 1213 | ARG is the prefix arg and may be used to indicate in the prompt which |
| 1214 | files are affected. | 1214 | FILES are affected. |
| 1215 | This is an extra function so that you can redefine it." | 1215 | This is an extra function so that you can redefine it." |
| 1216 | (dired-mark-pop-up | 1216 | (minibuffer-with-setup-hook |
| 1217 | nil 'shell files | 1217 | (lambda () |
| 1218 | 'dired-guess-shell-command | 1218 | (set (make-local-variable 'minibuffer-default-add-function) |
| 1219 | (format prompt (dired-mark-prompt arg files)) ; PROMPT | 1219 | 'minibuffer-default-add-dired-shell-commands)) |
| 1220 | files)) ; FILES | 1220 | (dired-mark-pop-up |
| 1221 | nil 'shell files | ||
| 1222 | 'dired-guess-shell-command | ||
| 1223 | (format prompt (dired-mark-prompt arg files)) ; PROMPT | ||
| 1224 | files))) ; FILES | ||
| 1221 | 1225 | ||
| 1222 | 1226 | ||
| 1223 | ;;; RELATIVE SYMBOLIC LINKS. | 1227 | ;;; RELATIVE SYMBOLIC LINKS. |