From d6e96966e86d8eadec446788d19144bd69b1e798 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 19 Feb 2011 11:20:38 -0800 Subject: [PATCH] Merge dired-x's dired-read-shell-command into dired-aux's version. * 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 | 3 ++- doc/misc/dired-x.texi | 13 +++++++------ lisp/ChangeLog | 3 +++ lisp/dired-aux.el | 20 ++++++++++++-------- lisp/dired-x.el | 27 ++++----------------------- 5 files changed, 28 insertions(+), 38 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index d6fbc06d721..cbe4fbbeb1b 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,7 +1,8 @@ 2011-02-19 Glenn Morris * 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 diff --git a/doc/misc/dired-x.texi b/doc/misc/dired-x.texi index 3bc2964c1b3..4a542d9841b 100644 --- a/doc/misc/dired-x.texi +++ b/doc/misc/dired-x.texi @@ -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 diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8372c03f73d..0f2fa15d678 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2011-02-19 Glenn Morris + * 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. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index bf70262ee73..986c9edfd2d 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -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) diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 1810d59712d..042fbe0b085 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -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 - ;;; RELATIVE SYMBOLIC LINKS. -- 2.39.5