From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] minibuffer issue with eshell-command Date: Fri, 07 Oct 2011 16:04:39 +0200 Message-ID: <878vowj3t4.fsf@gmail.com> References: <87lisy7g00.fsf@gmail.com> <87hb3me15c.fsf@gmail.com> <877h4irsye.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1317996310 6366 80.91.229.12 (7 Oct 2011 14:05:10 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 7 Oct 2011 14:05:10 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 07 16:05:06 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RCB2u-0004Xg-U3 for ged-emacs-devel@m.gmane.org; Fri, 07 Oct 2011 16:05:05 +0200 Original-Received: from localhost ([::1]:40495 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCB2t-0002Lp-Od for ged-emacs-devel@m.gmane.org; Fri, 07 Oct 2011 10:05:03 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:60169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCB2n-0002LR-V4 for emacs-devel@gnu.org; Fri, 07 Oct 2011 10:05:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RCB2j-0000UQ-S7 for emacs-devel@gnu.org; Fri, 07 Oct 2011 10:04:57 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:40853) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCB2j-0000UK-Im for emacs-devel@gnu.org; Fri, 07 Oct 2011 10:04:53 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RCB2h-0004RI-OS for emacs-devel@gnu.org; Fri, 07 Oct 2011 16:04:51 +0200 Original-Received: from 83.78.88.79.rev.sfr.net ([79.88.78.83]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Oct 2011 16:04:51 +0200 Original-Received: from thierry.volpiatto by 83.78.88.79.rev.sfr.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Oct 2011 16:04:51 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 57 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 83.78.88.79.rev.sfr.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux) Cancel-Lock: sha1:5UrjZQnH/9q539OjXo2XXMss1PA= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:144697 Archived-At: Thierry Volpiatto writes: > Stefan Monnier 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