]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/eshell/eshell.el (eshell-command): Avoid using hooks.
authorthierry volpiatto <thierry.volpiatto@gmail.com>
Sat, 8 Oct 2011 06:08:00 +0000 (08:08 +0200)
committerthierry volpiatto <thierry.volpiatto@gmail.com>
Sat, 8 Oct 2011 06:08:00 +0000 (08:08 +0200)
lisp/ChangeLog
lisp/eshell/eshell.el

index 6c32655d96c521031cbf541b8054647112419e09..fdc61721a13a46c1ffad1bfdc98d15181d070f4d 100644 (file)
@@ -1,3 +1,7 @@
+2011-10-08  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
+
+       * lisp/eshell/eshell.el (eshell-command): Avoid using hooks.
+
 2011-10-07  Chong Yidong  <cyd@stupidchicken.com>
 
        * bindings.el ([M-left],[M-right]): Bind to left-word and
index 08bb30d67baa9ef097bf1e44f09b8f9428ccdd9e..c33c2ccf9d1f08b3dd77ab38986d327937e3cd64 100644 (file)
@@ -344,16 +344,16 @@ With prefix ARG, insert output into the current buffer at point."
   (require 'esh-cmd)
   (unless arg
     (setq arg current-prefix-arg))
-  (unwind-protect
-      (let ((eshell-non-interactive-p t))
-        ;; Enable `eshell-mode' only in this minibuffer.
-        (minibuffer-with-setup-hook 'eshell-mode
-          (add-hook 'minibuffer-exit-hook 'eshell-add-command-to-history)
-          (add-hook 'eshell-mode-hook 'eshell-return-exits-minibuffer)
-          (unless command
-            (setq command (read-from-minibuffer "Emacs shell command: ")))))
-    (remove-hook 'eshell-mode-hook 'eshell-return-exits-minibuffer)
-    (remove-hook 'minibuffer-exit-hook 'eshell-add-command-to-history))
+  (let ((eshell-non-interactive-p t))
+    ;; Enable `eshell-mode' only in this minibuffer.
+    (minibuffer-with-setup-hook #'(lambda ()
+                                    (eshell-mode)
+                                    (eshell-return-exits-minibuffer))
+      (unwind-protect
+           (unless command
+             (setq command (read-from-minibuffer "Emacs shell command: ")))
+        (when command
+          (eshell-add-input-to-history command)))))
   (unless command
     (error "No command specified!"))
   ;; redirection into the current buffer is achieved by adding an