Merge dired-x's dired-read-shell-command into dired-aux's version.
authorGlenn Morris <rgm@gnu.org>
Sat, 19 Feb 2011 19:20:38 +0000 (11:20 -0800)
committerGlenn Morris <rgm@gnu.org>
Sat, 19 Feb 2011 19:20:38 +0000 (11:20 -0800)
* lisp/dired-x.el (dired-read-shell-command): Merge into dired-aux's version.

* lisp/dired-aux.el (dired-read-shell-command): Merge dired-x's version.

* doc/misc/dired-x.texi (Technical Details):
No longer redefines dired-read-shell-command.

doc/misc/ChangeLog
doc/misc/dired-x.texi
lisp/ChangeLog
lisp/dired-aux.el
lisp/dired-x.el

index d6fbc06..cbe4fbb 100644 (file)
@@ -1,7 +1,8 @@
 2011-02-19  Glenn Morris  <rgm@gnu.org>
 
        * dired-x.texi (Technical Details): No longer redefines dired-add-entry,
-       dired-initial-position, or dired-clean-up-after-deletion.
+       dired-initial-position, dired-clean-up-after-deletion, or
+       dired-read-shell-command.
 
 2011-02-18  Glenn Morris  <rgm@gnu.org>
 
index 3bc2964..4a542d9 100644 (file)
@@ -177,15 +177,16 @@ Point}).
 @cindex Redefined functions
 @cindex @file{dired-aux.el}
 
-When loaded this code @emph{redefines} some standard Dired functions.
-From @file{dired.el}, the function @code{dired-find-buffer-nocreate}; 
-and from @file{dired-aux.el} the function @code{dired-read-shell-command}.
-In addition, once @file{dired-x.el} is loaded, the following Dired
-functions offer additional features.  @code{dired-add-entry} obeys Dired
-Omit mode (@pxref{Omitting Files in Dired}), if it is active.
+When loaded this code @emph{redefines} the standard @file{dired.el}
+function @code{dired-find-buffer-nocreate}.  In addition, once
+@file{dired-x.el} is loaded, the following Dired functions offer
+additional features.  @code{dired-add-entry} obeys Dired Omit mode
+(@pxref{Omitting Files in Dired}), if it is active.
 @code{dired-initial-position} obeys @code{dired-find-subdir}
 (@pxref{Miscellaneous Commands}).  @code{dired-clean-up-after-deletion}
 respects the value of @code{dired-clean-up-buffers-too}.
+@code{dired-read-shell-command} uses @code{dired-guess-shell-command}
+(@pxref{Shell Command Guessing}) to offer a smarter default command.
 
 @node Installation, Omitting Files in Dired, Introduction, Top
 @chapter Installation
index 8372c03..0f2fa15 100644 (file)
@@ -1,5 +1,8 @@
 2011-02-19  Glenn Morris  <rgm@gnu.org>
 
+       * dired-x.el (dired-read-shell-command): Merge into dired-aux's version.
+       * dired-aux.el (dired-read-shell-command): Merge dired-x's version.
+
        * dired-x.el (dired-clean-up-after-deletion): Merge into dired.el.
        * dired.el (dired-clean-up-after-deletion): Merge dired-x's version.
        (dired-clean-up-buffers-too): Declare.
index bf70262..986c9ed 100644 (file)
@@ -509,18 +509,22 @@ to the end of the list of defaults just after the default value."
 
 ;; This is an extra function so that you can redefine it, e.g., to use gmhist.
 (defun dired-read-shell-command (prompt arg files)
-  "Read a dired shell command prompting with PROMPT (using `read-shell-command').
-ARG is the prefix arg and may be used to indicate in the prompt which
-FILES are affected."
+  "Read a dired shell command prompting with PROMPT.
+Passes the prefix argument ARG to `dired-mark-prompt', so that it
+can be used in the prompt to indicate which FILES are affected.
+Normally reads the command with `read-shell-command', but if the
+`dired-x' packages is loaded, uses `dired-guess-shell-command' to offer
+a smarter default choice of shell command."
   (minibuffer-with-setup-hook
       (lambda ()
        (set (make-local-variable 'minibuffer-default-add-function)
             'minibuffer-default-add-dired-shell-commands))
-    (dired-mark-pop-up
-     nil 'shell files
-     #'read-shell-command
-     (format prompt (dired-mark-prompt arg files))
-     nil nil)))
+    (setq prompt (format prompt (dired-mark-prompt arg files)))
+    (if (featurep 'dired-x)
+       (dired-mark-pop-up nil 'shell files
+                          #'dired-guess-shell-command prompt files)
+      (dired-mark-pop-up nil 'shell files
+                        #'read-shell-command prompt nil nil))))
 
 ;;;###autoload
 (defun dired-do-async-shell-command (command &optional arg file-list)
index 1810d59..042fbe0 100644 (file)
@@ -47,9 +47,7 @@
 
 ;; User customization: M-x customize-group RET dired-x RET.
 
-;; When loaded this code redefines the following functions of GNU Emacs:
-;; From dired.el: dired-find-buffer-nocreate.
-;; From dired-aux.el: dired-read-shell-command.
+;; When loaded this code redefines dired.el's dired-find-buffer-nocreate.
 
 ;; *Please* see the `dired-x' info pages for more details.
 
@@ -804,10 +802,10 @@ dired."
 
 ;; Brief Description:
 ;;;
-;; `dired-do-shell-command' is bound to `!' by dired.el.
+;; `dired-do-shell-command' is bound to `!' by dired.el.
 ;;;
-;; * Redefine `dired-read-shell-command' so it calls
-;;;   `dired-guess-shell-command'.
+;; * `dired-guess-shell-command' provides smarter defaults for
+;;;    dired-aux.el's `dired-read-shell-command'.
 ;;;
 ;; * `dired-guess-shell-command' calls `dired-guess-default' with list of
 ;;;    marked files.
@@ -1094,23 +1092,6 @@ See `dired-guess-shell-alist-user'."
       ;; If we got a return, then return default.
       (if (equal val "") default val))))
 
-;; REDEFINE.
-;; Redefine dired-aux.el's version:
-(defun dired-read-shell-command (prompt arg files)
-  "Read a dired shell command prompting with PROMPT (using `read-shell-command').
-ARG is the prefix arg and may be used to indicate in the prompt which
-FILES are affected.
-This is an extra function so that you can redefine it."
-  (minibuffer-with-setup-hook
-      (lambda ()
-        (set (make-local-variable 'minibuffer-default-add-function)
-             'minibuffer-default-add-dired-shell-commands))
-    (dired-mark-pop-up
-     nil 'shell files
-     'dired-guess-shell-command
-     (format prompt (dired-mark-prompt arg files)) ; PROMPT
-     files)))                                      ; FILES
-
 \f
 ;;; RELATIVE SYMBOLIC LINKS.