# HG changeset patch # User Juri Linkov # Date 1208893957 0 # Node ID 3849fa236ab23c8603a614b16d70531bb5631241 # Parent 2816dadb8db98e617c4223cacba9e554d50d8893 (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 -r 2816dadb8db9 -r 3849fa236ab2 lisp/dired-x.el --- a/lisp/dired-x.el Tue Apr 22 19:51:57 2008 +0000 +++ b/lisp/dired-x.el Tue Apr 22 19:52:37 2008 +0000 @@ -838,13 +838,22 @@ (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.