]> git.eshelyaron.com Git - emacs.git/commitdiff
(dired-smart-shell-command): Sync arguments and
authorJuri Linkov <juri@jurta.org>
Tue, 22 Apr 2008 19:54:27 +0000 (19:54 +0000)
committerJuri Linkov <juri@jurta.org>
Tue, 22 Apr 2008 19:54:27 +0000 (19:54 +0000)
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.

lisp/ChangeLog
lisp/dired-x.el

index 7466a38b7137b135befccfcd100e16548bf5c6f4..d7ae805cc10e6905229c755918053f6032c8b762 100644 (file)
@@ -1,3 +1,35 @@
+2008-04-22  Juri Linkov  <juri@jurta.org>
+
+       * 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  <lekktu@gmail.com>
 
        * info.el (Info-complete-menu-item): Add missing parenthesis.
index bd695b322e5ba62ad86dbe79f6ee83c9b2eb15e2..22241a22c9512e5779e5de230a1651ac1d15226e 100644 (file)
@@ -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)))
 
 \f
 ;;; LOCAL VARIABLES FOR DIRED BUFFERS.