all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: [PATCH] minibuffer issue with eshell-command
Date: Fri, 07 Oct 2011 16:04:39 +0200	[thread overview]
Message-ID: <878vowj3t4.fsf@gmail.com> (raw)
In-Reply-To: 877h4irsye.fsf@gmail.com

Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> 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	other threads:[~2011-10-07 14:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-06  7:09 [PATCH] minibuffer issue with eshell-command Thierry Volpiatto
2011-10-06 12:48 ` Thierry Volpiatto
2011-10-06 15:00   ` Chong Yidong
2011-10-06 15:36   ` Stefan Monnier
2011-10-06 16:22     ` Thierry Volpiatto
2011-10-07 14:04       ` Thierry Volpiatto [this message]
2011-10-07 19:12         ` Thierry Volpiatto
2011-10-10 18:36           ` Thierry Volpiatto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878vowj3t4.fsf@gmail.com \
    --to=thierry.volpiatto@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.