From: thierry volpiatto Date: Sat, 8 Oct 2011 06:08:00 +0000 (+0200) Subject: * lisp/eshell/eshell.el (eshell-command): Avoid using hooks. X-Git-Tag: emacs-pretest-24.0.91~186 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=61a57ef48995138f7b798d979ff189751f0acbfc;p=emacs.git * lisp/eshell/eshell.el (eshell-command): Avoid using hooks. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6c32655d96c..fdc61721a13 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2011-10-08 Thierry Volpiatto + + * lisp/eshell/eshell.el (eshell-command): Avoid using hooks. + 2011-10-07 Chong Yidong * bindings.el ([M-left],[M-right]): Bind to left-word and diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el index 08bb30d67ba..c33c2ccf9d1 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