emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] minibuffer issue with eshell-command


From: Thierry Volpiatto
Subject: Re: [PATCH] minibuffer issue with eshell-command
Date: Fri, 07 Oct 2011 16:04:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux)

Thierry Volpiatto <address@hidden> writes:

> Stefan Monnier <address@hidden> writes:
>
>>>> When eshell-command start, it set eshell-mode in all minibuffers:
>>>> ;(add-hook 'minibuffer-setup-hook 'eshell-mode)
>>>> So when running another minibuffer, while eshell-command is started,
>>>> it enable eshell-mode in this one, which is wrong.
>>>> This patch fix this:
>>
>>> Any objections to push this on trunk?
>>
>> That looks OK, except that I think the add-hooks should be moved to the
>> setup-hook function where they can be made to only apply locally (and
>> I guess at that point you can get rid of the remove-hooks).
> Right.
> I have already commited this, i will modify tomorrow.
I don't see the post of this morning to Leo, so i resend here.

diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
index 08bb30d..c33c2cc 100644
--- a/lisp/eshell/eshell.el
+++ b/lisp/eshell/eshell.el
@@ -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

Have a look please.

-- 
 𝕋𝕙𝕚𝕖𝕣𝕣𝕪
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]