]> code.delx.au - gnu-emacs/blobdiff - lisp/eshell/eshell.el
Merge from emacs-24; up to 2014-07-17T10:18:19Z!dmantipov@yandex.ru
[gnu-emacs] / lisp / eshell / eshell.el
index a76adb1fd944242d5e173d6c850b44226e2d82f3..af67266e67b34e3b7e6137b3d04bf6809059ca78 100644 (file)
@@ -1,6 +1,6 @@
-;;; eshell.el --- the Emacs command shell
+;;; eshell.el --- the Emacs command shell  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2013 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2014 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Version: 2.4.2
 ;; @ 4nt
 ;; @ csh
 
-;;;_* Speeding up load time
-;;
-;; If you find that Eshell loads too slowly, there is something you
-;; can do to speed it up.
-;;
-;; Create a file, named /tmp/elc, containing this filelist:
-;;
-;;   esh-util.elc
-;;   eshell.elc
-;;   esh-module.elc
-;;   esh-var.elc
-;;   esh-proc.elc
-;;   esh-arg.elc
-;;   esh-io.elc
-;;   esh-ext.elc
-;;   esh-cmd.elc
-;;   esh-mode.elc
-;;   esh-opt.elc
-;;   em-alias.elc
-;;   em-banner.elc
-;;   em-basic.elc
-;;   em-cmpl.elc
-;;   em-dirs.elc
-;;   em-pred.elc
-;;   em-glob.elc
-;;   em-hist.elc
-;;   em-ls.elc
-;;   em-prompt.elc
-;;   em-rebind.elc
-;;   em-script.elc
-;;   em-smart.elc
-;;   em-term.elc
-;;   em-unix.elc
-;;   em-xtra.elc
-;;
-;; The order is very important.  Remove from the filelist any features
-;; you don't use.  These all begin with "em-".  If you don't use
-;; Eshell's key rebinding module, you can remove "em-rebind.elc" from
-;; the filelist.  The modules you are currently using are listed in
-;; `eshell-modules-list'.
-;;
-;; Now, concatenating all of the above mentioned .elc files, in that
-;; order, to another file.  Here is how to do this on UNIX:
-;;
-;;   cat `cat /tmp/elc` > tmp.elc ; mv tmp.elc eshell.elc
-;;
-;; Now your eshell.elc file contains all of the .elc files that make
-;; up Eshell, in the right load order.  When you next load Eshell, it
-;; will only have to read in this one file, which will greatly speed
-;; things up.
+;;; Code:
 
 (eval-when-compile
-  (require 'cl-lib)
-  (require 'esh-util))
+  (require 'cl-lib))
 (require 'esh-util)
 (require 'esh-mode)
 
@@ -301,7 +251,7 @@ buffer selected (or created)."
                    (get-buffer-create eshell-buffer-name)))))
     (cl-assert (and buf (buffer-live-p buf)))
     (pop-to-buffer-same-window buf)
-    (unless (eq major-mode 'eshell-mode)
+    (unless (derived-mode-p 'eshell-mode)
       (eshell-mode))
     buf))
 
@@ -318,6 +268,8 @@ buffer selected (or created)."
 Modules should use this variable so that they don't clutter
 non-interactive sessions, such as when using `eshell-command'.")
 
+(declare-function eshell-add-input-to-history "em-hist" (input))
+
 ;;;###autoload
 (defun eshell-command (&optional command arg)
   "Execute the Eshell command string COMMAND.
@@ -333,7 +285,8 @@ With prefix ARG, insert output into the current buffer at point."
                                     (eshell-return-exits-minibuffer))
       (unless command
         (setq command (read-from-minibuffer "Emacs shell command: "))
-        (eshell-add-input-to-history command))))
+       (if (eshell-using-module 'eshell-hist)
+           (eshell-add-input-to-history command)))))
   (unless command
     (error "No command specified!"))
   ;; redirection into the current buffer is achieved by adding an