comparison lisp/dired-x.el @ 94255:3849fa236ab2

(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.
author Juri Linkov <juri@jurta.org>
date Tue, 22 Apr 2008 19:52:37 +0000
parents be53eb871301
children 620608825355
comparison
equal deleted inserted replaced
94254:2816dadb8db9 94255:3849fa236ab2
836 "Usage like variable `default-directory'. 836 "Usage like variable `default-directory'.
837 Knows about the special cases in variable `default-directory-alist'." 837 Knows about the special cases in variable `default-directory-alist'."
838 (or (eval (cdr (assq major-mode default-directory-alist))) 838 (or (eval (cdr (assq major-mode default-directory-alist)))
839 default-directory)) 839 default-directory))
840 840
841 (defun dired-smart-shell-command (cmd &optional insert) 841 (defun dired-smart-shell-command (command &optional output-buffer error-buffer)
842 "Like function `shell-command', but in the current Virtual Dired directory." 842 "Like function `shell-command', but in the current Virtual Dired directory."
843 (interactive (list (read-from-minibuffer "Shell command: " 843 (interactive
844 nil nil nil 'shell-command-history) 844 (list
845 current-prefix-arg)) 845 (minibuffer-with-setup-hook
846 (lambda ()
847 (set (make-local-variable 'minibuffer-default-add-function)
848 'minibuffer-default-add-shell-commands))
849 (read-shell-command "Shell command: " nil nil
850 (cond
851 (buffer-file-name (file-relative-name buffer-file-name))
852 ((eq major-mode 'dired-mode) (dired-get-filename t t)))))
853 current-prefix-arg
854 shell-command-default-error-buffer))
846 (let ((default-directory (dired-default-directory))) 855 (let ((default-directory (dired-default-directory)))
847 (shell-command cmd insert))) 856 (shell-command command output-buffer error-buffer)))
848 857
849 858
850 ;;; LOCAL VARIABLES FOR DIRED BUFFERS. 859 ;;; LOCAL VARIABLES FOR DIRED BUFFERS.
851 860
852 ;;; Brief Description: 861 ;;; Brief Description: