]> code.delx.au - gnu-emacs/blobdiff - lisp/eshell/eshell.el
Standardize possessive apostrophe usage in manuals, docs, and comments
[gnu-emacs] / lisp / eshell / eshell.el
index 89ec3ab9c601c97592fbdfa81f911171a3d73e88..224451eacbae510d23e850b2f7580ad5d2d91687 100644 (file)
@@ -1,7 +1,6 @@
 ;;; eshell.el --- the Emacs command shell
 
-;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2012 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Version: 2.4.2
 ;;   paragraph wasn't discovered until two months after I wrote the
 ;;   text; it was not intentional).
 ;;
-;; @ Emacs' register and bookmarking facilities can be used for
+;; @ Emacs's register and bookmarking facilities can be used for
 ;;   remembering where you've been, and what you've seen -- to varying
 ;;   levels of persistence.  They could perhaps even be tied to
 ;;   specific "moments" during eshell execution, which would include
 ;;   the environment at that time, as well as other variables.
-;;   Although this would require functionality orthogonal to Emacs'
+;;   Although this would require functionality orthogonal to Emacs's
 ;;   own bookmarking facilities, the interface used could be made to
 ;;   operate very similarly.
 ;;
@@ -281,25 +280,12 @@ shells such as bash, zsh, rc, 4dos."
   :type 'string
   :group 'eshell)
 
-(eshell-deftest mode same-window-buffer-names
-  "`eshell-buffer-name' is a member of `same-window-buffer-names'"
-  (member eshell-buffer-name same-window-buffer-names))
-
-(defcustom eshell-directory-name (convert-standard-filename "~/.eshell/")
+(defcustom eshell-directory-name
+  (locate-user-emacs-file "eshell/" ".eshell/")
   "The directory where Eshell control files should be kept."
   :type 'directory
   :group 'eshell)
 
-(eshell-deftest mode eshell-directory-exists
-  "`eshell-directory-name' exists and is writable"
-  (file-writable-p eshell-directory-name))
-
-(eshell-deftest mode eshell-directory-modes
-  "`eshell-directory-name' has correct access protections"
-  (or (eshell-under-windows-p)
-      (= (file-modes eshell-directory-name)
-        eshell-private-directory-modes)))
-
 ;;;_* Running Eshell
 ;;
 ;; There are only three commands used to invoke Eshell.  The first two
@@ -358,16 +344,14 @@ 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))
-       (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: "))))
-    (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))
+  (let ((eshell-non-interactive-p t))
+    ;; Enable `eshell-mode' only in this minibuffer.
+    (minibuffer-with-setup-hook #'(lambda ()
+                                    (eshell-mode)
+                                    (eshell-return-exits-minibuffer))
+      (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
@@ -450,10 +434,6 @@ corresponding to a successful execution."
              (set status-var eshell-last-command-status))
          (cadr result))))))
 
-(eshell-deftest mode simple-command-result
-  "`eshell-command-result' works with a simple command."
-  (= (eshell-command-result "+ 1 2") 3))
-
 ;;;_* Reporting bugs
 ;;
 ;; If you do encounter a bug, on any system, please report
@@ -474,7 +454,7 @@ Emacs."
   ;; if the user set `eshell-prefer-to-shell' to t, but never loaded
   ;; Eshell, then `eshell-subgroups' will be unbound
   (when (fboundp 'eshell-subgroups)
-    (eshell-for module (eshell-subgroups 'eshell)
+    (dolist (module (eshell-subgroups 'eshell))
       ;; this really only unloads as many modules as possible,
       ;; since other `require' references (such as by customizing
       ;; `eshell-prefer-to-shell' to a non-nil value) might make it
@@ -490,5 +470,4 @@ Emacs."
 
 (provide 'eshell)
 
-;; arch-tag: 9d4d5214-0e4e-4e02-b349-39add640d63f
 ;;; eshell.el ends here