diff lisp/simple.el @ 97150:9718b5cb3616

(read-shell-command, shell-command): Move code that uses minibuffer-with-setup-hook to set minibuffer-default-add-function to minibuffer-default-add-shell-commands from the interactive spec of `shell-command' to `read-shell-command'.
author Juri Linkov <juri@jurta.org>
date Thu, 31 Jul 2008 16:51:21 +0000
parents 716070916653
children c7a00c2c8219
line wrap: on
line diff
--- a/lisp/simple.el	Thu Jul 31 16:51:09 2008 +0000
+++ b/lisp/simple.el	Thu Jul 31 16:51:21 2008 +0000
@@ -2012,11 +2012,15 @@
 The arguments are the same as the ones of `read-from-minibuffer',
 except READ and KEYMAP are missing and HIST defaults
 to `shell-command-history'."
-  (apply 'read-from-minibuffer prompt initial-contents
-         minibuffer-local-shell-command-map
-         nil
-         (or hist 'shell-command-history)
-         args))
+  (minibuffer-with-setup-hook
+      (lambda ()
+	(set (make-local-variable 'minibuffer-default-add-function)
+	     'minibuffer-default-add-shell-commands))
+    (apply 'read-from-minibuffer prompt initial-contents
+	   minibuffer-local-shell-command-map
+	   nil
+	   (or hist 'shell-command-history)
+	   args)))
 
 (defun shell-command (command &optional output-buffer error-buffer)
   "Execute string COMMAND in inferior shell; display output, if any.
@@ -2070,13 +2074,9 @@
 
   (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
-			  (and buffer-file-name
-			       (file-relative-name buffer-file-name))))
+    (read-shell-command "Shell command: " nil nil
+			(and buffer-file-name
+			     (file-relative-name buffer-file-name)))
     current-prefix-arg
     shell-command-default-error-buffer))
   ;; Look for a handler in case default-directory is a remote file name.