* [PATCH] minibuffer issue with eshell-command
@ 2011-10-06 7:09 Thierry Volpiatto
2011-10-06 12:48 ` Thierry Volpiatto
0 siblings, 1 reply; 8+ messages in thread
From: Thierry Volpiatto @ 2011-10-06 7:09 UTC (permalink / raw)
To: emacs-devel
Hi all,
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:
Fix minibuffer-issue in eshell-command.
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
---
lisp/eshell/eshell.el | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
index 1a9d7c9..34d05b0 100644
--- a/lisp/eshell/eshell.el
+++ b/lisp/eshell/eshell.el
@@ -346,14 +346,13 @@ With prefix ARG, insert output into the current buffer at point."
(setq arg current-prefix-arg))
(unwind-protect
(let ((eshell-non-interactive-p t))
- (add-hook 'minibuffer-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: "))))
+ (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)
- (remove-hook 'minibuffer-setup-hook 'eshell-mode))
+ (remove-hook 'minibuffer-exit-hook 'eshell-add-command-to-history))
(unless command
(error "No command specified!"))
;; redirection into the current buffer is achieved by adding an
--
𝕋𝕙𝕚𝕖𝕣𝕣𝕪
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] minibuffer issue with eshell-command
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
0 siblings, 2 replies; 8+ messages in thread
From: Thierry Volpiatto @ 2011-10-06 12:48 UTC (permalink / raw)
To: emacs-devel
Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
> Hi all,
> 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?
> Fix minibuffer-issue in eshell-command.
>
> From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
>
>
> ---
> lisp/eshell/eshell.el | 13 ++++++-------
> 1 files changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
> index 1a9d7c9..34d05b0 100644
> --- a/lisp/eshell/eshell.el
> +++ b/lisp/eshell/eshell.el
> @@ -346,14 +346,13 @@ With prefix ARG, insert output into the current buffer at point."
> (setq arg current-prefix-arg))
> (unwind-protect
> (let ((eshell-non-interactive-p t))
> - (add-hook 'minibuffer-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: "))))
> + (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)
> - (remove-hook 'minibuffer-setup-hook 'eshell-mode))
> + (remove-hook 'minibuffer-exit-hook 'eshell-add-command-to-history))
> (unless command
> (error "No command specified!"))
> ;; redirection into the current buffer is achieved by adding an
--
𝕋𝕙𝕚𝕖𝕣𝕣𝕪
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] minibuffer issue with eshell-command
2011-10-06 12:48 ` Thierry Volpiatto
@ 2011-10-06 15:00 ` Chong Yidong
2011-10-06 15:36 ` Stefan Monnier
1 sibling, 0 replies; 8+ messages in thread
From: Chong Yidong @ 2011-10-06 15:00 UTC (permalink / raw)
To: Thierry Volpiatto; +Cc: emacs-devel
Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
> Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
>
>> Hi all,
>> 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?
Looks good, please go ahead.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] minibuffer issue with eshell-command
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
1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2011-10-06 15:36 UTC (permalink / raw)
To: Thierry Volpiatto; +Cc: emacs-devel
>> 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).
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] minibuffer issue with eshell-command
2011-10-06 15:36 ` Stefan Monnier
@ 2011-10-06 16:22 ` Thierry Volpiatto
2011-10-07 14:04 ` Thierry Volpiatto
0 siblings, 1 reply; 8+ messages in thread
From: Thierry Volpiatto @ 2011-10-06 16:22 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
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.
--
𝕋𝕙𝕚𝕖𝕣𝕣𝕪
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] minibuffer issue with eshell-command
2011-10-06 16:22 ` Thierry Volpiatto
@ 2011-10-07 14:04 ` Thierry Volpiatto
2011-10-07 19:12 ` Thierry Volpiatto
0 siblings, 1 reply; 8+ messages in thread
From: Thierry Volpiatto @ 2011-10-07 14:04 UTC (permalink / raw)
To: emacs-devel
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] minibuffer issue with eshell-command
2011-10-07 14:04 ` Thierry Volpiatto
@ 2011-10-07 19:12 ` Thierry Volpiatto
2011-10-10 18:36 ` Thierry Volpiatto
0 siblings, 1 reply; 8+ messages in thread
From: Thierry Volpiatto @ 2011-10-07 19:12 UTC (permalink / raw)
To: emacs-devel
Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
> 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.
Ok, if no more comments, i will push tomorrow.
--
𝕋𝕙𝕚𝕖𝕣𝕣𝕪
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] minibuffer issue with eshell-command
2011-10-07 19:12 ` Thierry Volpiatto
@ 2011-10-10 18:36 ` Thierry Volpiatto
0 siblings, 0 replies; 8+ messages in thread
From: Thierry Volpiatto @ 2011-10-10 18:36 UTC (permalink / raw)
To: emacs-devel
Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
Hi, i made some simplifications to my last patch and fix also a little
error:
When command is called from lisp, `eshell-add-input-to-history' should
not add history to ring. (this cause an error).
Here the patch:
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
index c33c2cc..0c1c039 100644
--- a/lisp/eshell/eshell.el
+++ b/lisp/eshell/eshell.el
@@ -349,11 +349,9 @@ With prefix ARG, insert output into the current buffer at point."
(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
+ (setq command (read-from-minibuffer "Emacs shell command: "))
+ (eshell-add-input-to-history command))))
(unless command
(error "No command specified!"))
;; redirection into the current buffer is achieved by adding an
If no objections i will install it tomorrow.
--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-10-10 18:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2011-10-07 19:12 ` Thierry Volpiatto
2011-10-10 18:36 ` Thierry Volpiatto
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).