From: Juri Linkov Date: Tue, 22 Apr 2008 19:54:27 +0000 (+0000) Subject: (dired-smart-shell-command): Sync arguments and X-Git-Tag: emacs-pretest-23.0.90~6125 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d3a89b9eabd70a259fd670bd76fb350e61ace603;p=emacs.git (dired-smart-shell-command): Sync arguments and interactive spec with changes in `shell-command'. Use dired-get-filename to get the dired file name at point as the default value in dired mode. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7466a38b713..d7ae805cc10 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,35 @@ +2008-04-22 Juri Linkov + + * minibuffer.el (internal-complete-buffer-except): New function. + + * files.el (read-buffer-to-switch): New function. + (switch-to-buffer-other-window, switch-to-buffer-other-frame): + Change interactive spec to call read-buffer-to-switch instead of + using the letter "B". + + * simple.el (minibuffer-default-add-shell-commands): New function. + Use declare-function for mailcap-file-default-commands from "mailcap". + (shell-command): Set local minibuffer-default-add-function to + minibuffer-default-add-shell-commands in minibuffer-with-setup-hook + before calling read-shell-command. Set 4th arg default-value of + read-shell-command to relative buffer-file-name in file buffers. + + * dired-aux.el (dired-read-shell-command-default): Move it to + gnus/mailcap.el and change its name to more general name + mailcap-file-default-commands. + (minibuffer-default-add-dired-shell-commands): New function. + Use declare-function for mailcap-file-default-commands from "mailcap". + (dired-read-shell-command): Set local minibuffer-default-add-function + to minibuffer-default-add-dired-shell-commands in minibuffer-with-setup-hook + before calling read-shell-command. Remove dired-read-shell-command-default + from the default value arg because default values are not set in + minibuffer-default-add-dired-shell-commands. Doc fix. + + * dired-x.el (dired-smart-shell-command): Sync arguments and + interactive spec with changes in `shell-command'. + Use dired-get-filename to get the dired file name at point + as the default value in dired mode. + 2008-04-22 Juanma Barranquero * info.el (Info-complete-menu-item): Add missing parenthesis. diff --git a/lisp/dired-x.el b/lisp/dired-x.el index bd695b322e5..22241a22c95 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -838,13 +838,22 @@ Knows about the special cases in variable `default-directory-alist'." (or (eval (cdr (assq major-mode default-directory-alist))) default-directory)) -(defun dired-smart-shell-command (cmd &optional insert) +(defun dired-smart-shell-command (command &optional output-buffer error-buffer) "Like function `shell-command', but in the current Virtual Dired directory." - (interactive (list (read-from-minibuffer "Shell command: " - nil nil nil 'shell-command-history) - current-prefix-arg)) + (interactive + (list + (minibuffer-with-setup-hook + (lambda () + (set (make-local-variable 'minibuffer-default-add-function) + 'minibuffer-default-add-shell-commands)) + (read-shell-command "Shell command: " nil nil + (cond + (buffer-file-name (file-relative-name buffer-file-name)) + ((eq major-mode 'dired-mode) (dired-get-filename t t))))) + current-prefix-arg + shell-command-default-error-buffer)) (let ((default-directory (dired-default-directory))) - (shell-command cmd insert))) + (shell-command command output-buffer error-buffer))) ;;; LOCAL VARIABLES FOR DIRED BUFFERS.