diff options
author | Miles Bader <miles@gnu.org> | 2007-12-06 09:51:45 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2007-12-06 09:51:45 +0000 |
commit | 0bd508417142ff377f34aec8dcec9438d9175c2c (patch) | |
tree | 4d60fe09e5cebf7d79766b11e9cda8cc1c9dbb9b /lisp/eshell | |
parent | 98fe991da804a42f53f6a5e84cd5eab18a82e181 (diff) | |
parent | 9fb1ba8090da3528de56158a79bd3527d31c7f2f (diff) | |
download | emacs-0bd508417142ff377f34aec8dcec9438d9175c2c.tar.gz emacs-0bd508417142ff377f34aec8dcec9438d9175c2c.tar.bz2 emacs-0bd508417142ff377f34aec8dcec9438d9175c2c.zip |
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-294
Diffstat (limited to 'lisp/eshell')
29 files changed, 394 insertions, 454 deletions
diff --git a/lisp/eshell/em-alias.el b/lisp/eshell/em-alias.el index 8ecc335523b..dd61dac0594 100644 --- a/lisp/eshell/em-alias.el +++ b/lisp/eshell/em-alias.el @@ -22,17 +22,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'em-alias) - -(eval-when-compile (require 'esh-maint)) -(require 'eshell) - -(defgroup eshell-alias nil - "Command aliases allow for easy definition of alternate commands." - :tag "Command aliases" - ;; :link '(info-link "(eshell)Command aliases") - :group 'eshell-module) - ;;; Commentary: ;; Command aliases greatly simplify the definition of new commands. @@ -62,19 +51,8 @@ ;; ;; Aliases are written to disk immediately after being defined or ;; deleted. The filename in which they are kept is defined by the -;; following variable: +;; variable eshell-aliases-file. -(defcustom eshell-aliases-file (concat eshell-directory-name "alias") - "*The file in which aliases are kept. -Whenever an alias is defined by the user, using the `alias' command, -it will be written to this file. Thus, alias definitions (and -deletions) are always permanent. This approach was chosen for the -sake of simplicity, since that's pretty much the only benefit to be -gained by using this module." - :type 'file - :group 'eshell-alias) - -;;; ;; The format of this file is quite basic. It specifies the alias ;; definitions in almost exactly the same way that the user entered ;; them, minus any argument quoting (since interpolation is not done @@ -102,19 +80,12 @@ gained by using this module." ;; mispelled command, once a given tolerance threshold has been ;; reached. -(defcustom eshell-bad-command-tolerance 3 - "*The number of failed commands to ignore before creating an alias." - :type 'integer - ;; :link '(custom-manual "(eshell)Auto-correction of bad commands") - :group 'eshell-alias) - -;;; -;; Whenever the same bad command name is encountered this many times, -;; the user will be prompted in the minibuffer to provide an alias -;; name. An alias definition will then be created which will result -;; in an equal call to the correct name. In this way, Eshell -;; gradually learns about the commands that the user mistypes -;; frequently, and will automatically correct them! +;; Whenever the same bad command name is encountered +;; `eshell-bad-command-tolerance' times, the user will be prompted in +;; the minibuffer to provide an alias name. An alias definition will +;; then be created which will result in an equal call to the correct +;; name. In this way, Eshell gradually learns about the commands that +;; the user mistypes frequently, and will automatically correct them! ;; ;; Note that a '$*' is automatically appended at the end of the alias ;; definition, so that entering it is unnecessary when specifying the @@ -122,6 +93,32 @@ gained by using this module." ;;; Code: +(eval-when-compile + (require 'esh-util)) +(require 'eshell) + +(defgroup eshell-alias nil + "Command aliases allow for easy definition of alternate commands." + :tag "Command aliases" + ;; :link '(info-link "(eshell)Command aliases") + :group 'eshell-module) + +(defcustom eshell-aliases-file (concat eshell-directory-name "alias") + "*The file in which aliases are kept. +Whenever an alias is defined by the user, using the `alias' command, +it will be written to this file. Thus, alias definitions (and +deletions) are always permanent. This approach was chosen for the +sake of simplicity, since that's pretty much the only benefit to be +gained by using this module." + :type 'file + :group 'eshell-alias) + +(defcustom eshell-bad-command-tolerance 3 + "*The number of failed commands to ignore before creating an alias." + :type 'integer + ;; :link '(custom-manual "(eshell)Auto-correction of bad commands") + :group 'eshell-alias) + (defcustom eshell-alias-load-hook '(eshell-alias-initialize) "*A hook that gets run when `eshell-alias' is loaded." :type 'hook @@ -180,6 +177,9 @@ command, which will automatically write them to the file named by (eshell-write-aliases-list)) nil) +(defvar pcomplete-stub) +(autoload 'pcomplete-here "pcomplete") + (defun pcomplete/eshell-mode/alias () "Completion function for Eshell's `alias' command." (pcomplete-here (eshell-alias-completions pcomplete-stub))) @@ -274,5 +274,7 @@ These are all the command aliases which begin with NAME." eshell-prevent-alias-expansion)))) (eshell-parse-command alias)))))))))) +(provide 'em-alias) + ;;; arch-tag: 8b018fc1-4e07-4ccc-aa73-c0a1ba361f82 ;;; em-alias.el ends here diff --git a/lisp/eshell/em-banner.el b/lisp/eshell/em-banner.el index 17d930a055d..b9642f41df6 100644 --- a/lisp/eshell/em-banner.el +++ b/lisp/eshell/em-banner.el @@ -22,18 +22,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'em-banner) - -(eval-when-compile (require 'esh-maint)) - -(defgroup eshell-banner nil - "This sample module displays a welcome banner at login. -It exists so that others wishing to create their own Eshell extension -modules may have a simple template to begin with." - :tag "Login banner" - ;; :link '(info-link "(eshell)Login banner") - :group 'eshell-module) - ;;; Commentary: ;; There is nothing to be done or configured in order to use this @@ -51,6 +39,23 @@ modules may have a simple template to begin with." ;; In this case, it allows the user to change the string which ;; displays at login time. +;;; Code: + +(eval-when-compile + (require 'cl) + (require 'esh-mode) + (require 'eshell)) + +(require 'esh-util) + +(defgroup eshell-banner nil + "This sample module displays a welcome banner at login. +It exists so that others wishing to create their own Eshell extension +modules may have a simple template to begin with." + :tag "Login banner" + ;; :link '(info-link "(eshell)Login banner") + :group 'eshell-module) + ;;; User Variables: (defcustom eshell-banner-message "Welcome to the Emacs shell\n\n" @@ -61,10 +66,6 @@ This can be any sexp, and should end with at least two newlines." (put 'eshell-banner-message 'risky-local-variable t) -;;; Code: - -(require 'esh-util) - (defcustom eshell-banner-load-hook '(eshell-banner-initialize) "*A list of functions to run when `eshell-banner' is loaded." :type 'hook @@ -90,5 +91,7 @@ This can be any sexp, and should end with at least two newlines." (goto-char (point-min)) (looking-at msg))) +(provide 'em-banner) + ;;; arch-tag: e738b4ef-8671-42ae-a757-291779b92491 ;;; em-banner.el ends here diff --git a/lisp/eshell/em-basic.el b/lisp/eshell/em-basic.el index 458f6918de4..57f9a094141 100644 --- a/lisp/eshell/em-basic.el +++ b/lisp/eshell/em-basic.el @@ -22,19 +22,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'em-basic) - -(eval-when-compile (require 'esh-maint)) - -(defgroup eshell-basic nil - "The \"basic\" code provides a set of convenience functions which -are traditionally considered shell builtins. Since all of the -functionality provided by them is accessible through Lisp, they are -not really builtins at all, but offer a command-oriented way to do the -same thing." - :tag "Basic shell commands" - :group 'eshell-module) - ;;; Commentary: ;; There are very few basic Eshell commands -- so-called builtins. @@ -48,14 +35,6 @@ same thing." ;; echo as an argument), or whether it should try to act like a normal ;; shell echo, and always result in a flat string being returned. -(defcustom eshell-plain-echo-behavior nil - "*If non-nil, `echo' tries to behave like an ordinary shell echo. -This comes at some detriment to Lisp functionality. However, the Lisp -equivalent of `echo' can always be achieved by using `identity'." - :type 'boolean - :group 'eshell-basic) - -;;; ;; An example of the difference is the following: ;; ;; echo Hello world @@ -83,8 +62,27 @@ equivalent of `echo' can always be achieved by using `identity'." ;;; Code: +(eval-when-compile + (require 'esh-util)) + (require 'esh-opt) +(defgroup eshell-basic nil + "The \"basic\" code provides a set of convenience functions which +are traditionally considered shell builtins. Since all of the +functionality provided by them is accessible through Lisp, they are +not really builtins at all, but offer a command-oriented way to do the +same thing." + :tag "Basic shell commands" + :group 'eshell-module) + +(defcustom eshell-plain-echo-behavior nil + "*If non-nil, `echo' tries to behave like an ordinary shell echo. +This comes at some detriment to Lisp functionality. However, the Lisp +equivalent of `echo' can always be achieved by using `identity'." + :type 'boolean + :group 'eshell-basic) + ;;; Functions: (defun eshell-echo (args &optional output-newline) @@ -180,8 +178,7 @@ or `eshell-printn' for display." "Warning: umask changed for all new files created by Emacs.\n")) nil)) -(eval-when-compile - (defvar print-func)) +(provide 'em-basic) ;;; arch-tag: 385a31b1-cb95-46f0-9829-9d352ee77db8 ;;; em-basic.el ends here diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el index 7247033a235..b5f666a6bf6 100644 --- a/lisp/eshell/em-cmpl.el +++ b/lisp/eshell/em-cmpl.el @@ -22,18 +22,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'em-cmpl) - -(eval-when-compile (require 'esh-maint)) -(require 'esh-util) - -(defgroup eshell-cmpl nil - "This module provides a programmable completion function bound to -the TAB key, which allows for completing command names, file names, -variable names, arguments, etc." - :tag "Argument completion" - :group 'eshell-module) - ;;; Commentary: ;; Eshell, by using the pcomplete package, provides a full @@ -82,6 +70,19 @@ variable names, arguments, etc." ;; This only works well if the completion function has provided Eshell ;; with sufficient pointers to locate the relevant help text. +;;; Code: + +(eval-when-compile + (require 'eshell)) +(require 'esh-util) + +(defgroup eshell-cmpl nil + "This module provides a programmable completion function bound to +the TAB key, which allows for completing command names, file names, +variable names, arguments, etc." + :tag "Argument completion" + :group 'eshell-module) + ;;; User Variables: (defcustom eshell-cmpl-load-hook '(eshell-cmpl-initialize) @@ -296,7 +297,7 @@ to writing a completion function." (define-key eshell-mode-map [tab] 'pcomplete) (define-key eshell-mode-map [(control ?i)] 'pcomplete) ;; jww (1999-10-19): Will this work on anything but X? - (if (eshell-under-xemacs-p) + (if (featurep 'xemacs) (define-key eshell-mode-map [iso-left-tab] 'pcomplete-reverse) (define-key eshell-mode-map [(shift iso-lefttab)] 'pcomplete-reverse) (define-key eshell-mode-map [(shift control ?i)] 'pcomplete-reverse)) @@ -448,7 +449,7 @@ to writing a completion function." (all-completions filename obarray 'functionp)) completions))))))) -;;; Code: +(provide 'em-cmpl) ;;; arch-tag: 0e914699-673a-45f8-8cbf-82e1dbc571bc ;;; em-cmpl.el ends here diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el index 02556661b1b..8a1e81621bc 100644 --- a/lisp/eshell/em-dirs.el +++ b/lisp/eshell/em-dirs.el @@ -22,20 +22,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'em-dirs) - -(eval-when-compile (require 'esh-maint)) -(require 'eshell) - -(defgroup eshell-dirs nil - "Directory navigation involves changing directories, examining the -current directory, maintaining a directory stack, and also keeping -track of a history of the last directory locations the user was in. -Emacs does provide standard Lisp definitions of `pwd' and `cd', but -they lack somewhat in feel from the typical shell equivalents." - :tag "Directory navigation" - :group 'eshell-module) - ;;; Commentary: ;; The only special feature that Eshell offers in the last-dir-ring. @@ -57,9 +43,21 @@ they lack somewhat in feel from the typical shell equivalents." ;; Eshell sessions. It is a separate mechanism from `pushd' and ;; `popd', and the two may be used at the same time. +;;; Code: + +(require 'eshell) (require 'ring) (require 'esh-opt) +(defgroup eshell-dirs nil + "Directory navigation involves changing directories, examining the +current directory, maintaining a directory stack, and also keeping +track of a history of the last directory locations the user was in. +Emacs does provide standard Lisp definitions of `pwd' and `cd', but +they lack somewhat in feel from the typical shell equivalents." + :tag "Directory navigation" + :group 'eshell-module) + ;;; User Variables: (defcustom eshell-dirs-load-hook '(eshell-dirs-initialize) @@ -566,7 +564,7 @@ in the minibuffer: (write-region (point-min) (point-max) file nil 'no-message)))))))) -;;; Code: +(provide 'em-dirs) ;;; arch-tag: 1e9c5a95-f1bd-45f8-ad36-55aac706e787 ;;; em-dirs.el ends here diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el index 2e95aaefae0..b08ddd77e19 100644 --- a/lisp/eshell/em-glob.el +++ b/lisp/eshell/em-glob.el @@ -22,19 +22,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -;;; Code: - -(provide 'em-glob) - -(eval-when-compile (require 'esh-maint)) -(require 'esh-util) - -(defgroup eshell-glob nil - "This module provides extended globbing syntax, similar what is used -by zsh for filename generation." - :tag "Extended filename globbing" - :group 'eshell-module) - ;;; Commentary: ;; The globbing code used by Eshell closely follows the syntax used by @@ -63,6 +50,17 @@ by zsh for filename generation." ;; owned by the user 'johnw'. See [Value modifiers and predicates], ;; for more information about argument predication. +;;; Code: + +(eval-when-compile (require 'eshell)) +(require 'esh-util) + +(defgroup eshell-glob nil + "This module provides extended globbing syntax, similar what is used +by zsh for filename generation." + :tag "Extended filename globbing" + :group 'eshell-module) + ;;; User Variables: (defcustom eshell-glob-load-hook '(eshell-glob-initialize) @@ -356,5 +354,7 @@ the form: (eshell-glob-entries (car rdirs) globs recurse-p) (setq rdirs (cdr rdirs))))) +(provide 'em-glob) + ;;; arch-tag: d0548f54-fb7c-4978-a88e-f7c26f7f68ca ;;; em-glob.el ends here diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 88e15423956..2dd2b31d34a 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -22,16 +22,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'em-hist) - -(eval-when-compile (require 'esh-maint)) -(require 'eshell) - -(defgroup eshell-hist nil - "This module provides command history management." - :tag "History list management" - :group 'eshell-module) - ;;; Commentary: ;; Eshell's history facility imitates the syntax used by bash @@ -70,6 +60,12 @@ (require 'ring) (require 'esh-opt) (require 'em-pred) +(require 'eshell) + +(defgroup eshell-hist nil + "This module provides command history management." + :tag "History list management" + :group 'eshell-module) ;;; User Variables: @@ -988,5 +984,7 @@ If N is negative, search backwards for the -Nth previous match." (isearch-done) (eshell-send-input)) +(provide 'em-hist) + ;;; arch-tag: 1a847333-f864-4b96-9acd-b549d620b6c6 ;;; em-hist.el ends here diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el index d6b4f3aed29..01a6bb87a1f 100644 --- a/lisp/eshell/em-ls.el +++ b/lisp/eshell/em-ls.el @@ -22,9 +22,16 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'em-ls) +;;; Commentary: + +;; Most of the command switches recognized by GNU's ls utility are +;; supported ([(fileutils)ls invocation]). -(eval-when-compile (require 'esh-maint)) +;;; Code: + +(eval-when-compile (require 'eshell)) +(require 'esh-util) +(require 'esh-opt) (defgroup eshell-ls nil "This module implements the \"ls\" utility fully in Lisp. If it is @@ -35,14 +42,6 @@ properties to colorize its output based on the setting of :tag "Implementation of `ls' in Lisp" :group 'eshell-module) -;;; Commentary: - -;; Most of the command switches recognized by GNU's ls utility are -;; supported ([(fileutils)ls invocation]). - -(require 'esh-util) -(require 'esh-opt) - ;;; User Variables: (defvar eshell-ls-orig-insert-directory @@ -922,7 +921,7 @@ to use, and each member of which is the width of that column (car file))))) (car file)) -;;; Code: +(provide 'em-ls) ;;; arch-tag: 9295181c-0cb2-499c-999b-89f5359842cb ;;; em-ls.el ends here diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el index a7f68e4e222..628b8b61143 100644 --- a/lisp/eshell/em-pred.el +++ b/lisp/eshell/em-pred.el @@ -22,18 +22,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'em-pred) - -(eval-when-compile (require 'esh-maint)) - -(defgroup eshell-pred nil - "This module allows for predicates to be applied to globbing -patterns (similar to zsh), in addition to string modifiers which can -be applied either to globbing results, variable references, or just -ordinary strings." - :tag "Value modifiers and predicates" - :group 'eshell-module) - ;;; Commentary: ;; Argument predication is used to affect which members of a list are @@ -61,6 +49,16 @@ ordinary strings." ;;; Code: +(eval-when-compile (require 'eshell)) + +(defgroup eshell-pred nil + "This module allows for predicates to be applied to globbing +patterns (similar to zsh), in addition to string modifiers which can +be applied either to globbing results, variable references, or just +ordinary strings." + :tag "Value modifiers and predicates" + :group 'eshell-module) + ;;; User Variables: (defcustom eshell-pred-load-hook '(eshell-pred-initialize) @@ -602,5 +600,7 @@ that 'ls -l' will show in the first column of its display. " (lambda (str) (split-string str ,sep))) lst)))) +(provide 'em-pred) + ;;; arch-tag: 8b5ce022-17f3-4c40-93c7-5faafaa63f31 ;;; em-pred.el ends here diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el index ddbf74f5c42..57a1da74177 100644 --- a/lisp/eshell/em-prompt.el +++ b/lisp/eshell/em-prompt.el @@ -22,9 +22,14 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'em-prompt) +;;; Commentary: + +;; Most of the prompt navigation commands of `comint-mode' are +;; supported, such as C-c C-n, C-c C-p, etc. + +;;; Code: -(eval-when-compile (require 'esh-maint)) +(eval-when-compile (require 'eshell)) (defgroup eshell-prompt nil "This module provides command prompts, and navigation between them, @@ -32,11 +37,6 @@ as is common with most shells." :tag "Command prompts" :group 'eshell-module) -;;; Commentary: - -;; Most of the prompt navigation commands of `comint-mode' are -;; supported, such as C-c C-n, C-c C-p, etc. - ;;; User Variables: (defcustom eshell-prompt-load-hook '(eshell-prompt-initialize) @@ -173,7 +173,7 @@ If this takes us past the end of the current line, don't skip at all." (<= (match-end 0) eol)) (goto-char (match-end 0))))) -;;; Code: +(provide 'em-prompt) ;;; arch-tag: 01c1574b-ce70-4e89-bc38-e6619f61e208 ;;; em-prompt.el ends here diff --git a/lisp/eshell/em-rebind.el b/lisp/eshell/em-rebind.el index 898f0b9d301..b550016fbe1 100644 --- a/lisp/eshell/em-rebind.el +++ b/lisp/eshell/em-rebind.el @@ -22,9 +22,11 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'em-rebind) +;;; Commentary: + +;;; Code: -(eval-when-compile (require 'esh-maint)) +(eval-when-compile (require 'eshell)) (defgroup eshell-rebind nil "This module allows for special keybindings that only take effect @@ -39,8 +41,6 @@ the behavior of normal shells while the user editing new input text." :tag "Rebind keys at input" :group 'eshell-module) -;;; Commentary: - ;;; User Variables: (defcustom eshell-rebind-load-hook '(eshell-rebind-initialize) @@ -242,7 +242,7 @@ input." (eshell-life-is-too-much))) (eshell-delete-backward-char (- arg))))) -;;; Code: +(provide 'em-rebind) ;;; arch-tag: 76d84f12-cc56-4d67-9b7d-c6b44ad20530 ;;; em-rebind.el ends here diff --git a/lisp/eshell/em-script.el b/lisp/eshell/em-script.el index 50fdc3ccccc..0a83881c03f 100644 --- a/lisp/eshell/em-script.el +++ b/lisp/eshell/em-script.el @@ -22,9 +22,9 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'em-script) +;;; Commentary: -(eval-when-compile (require 'esh-maint)) +;;; Code: (require 'eshell) @@ -34,8 +34,6 @@ commands, as a script file." :tag "Running script files." :group 'eshell-module) -;;; Commentary: - ;;; User Variables: (defcustom eshell-script-load-hook '(eshell-script-initialize) @@ -137,7 +135,7 @@ environment, binding ARGS to $1, $2, etc.") (put 'eshell/. 'eshell-no-numeric-conversions t) -;;; Code: +(provide 'em-script) ;;; arch-tag: a346439d-5ba8-4faf-ac2b-3aacfeaa4647 ;;; em-script.el ends here diff --git a/lisp/eshell/em-smart.el b/lisp/eshell/em-smart.el index f99a64bd17d..ffb1b4a4d92 100644 --- a/lisp/eshell/em-smart.el +++ b/lisp/eshell/em-smart.el @@ -22,21 +22,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'em-smart) - -(eval-when-compile (require 'esh-maint)) - -(defgroup eshell-smart nil - "This module combines the facility of normal, modern shells with -some of the edit/review concepts inherent in the design of Plan 9's -9term. See the docs for more details. - -Most likely you will have to turn this option on and play around with -it to get a real sense of how it works." - :tag "Smart display of output" - ;; :link '(info-link "(eshell)Smart display of output") - :group 'eshell-module) - ;;; Commentary: ;; The best way to get a sense of what this code is trying to do is by @@ -84,6 +69,21 @@ it to get a real sense of how it works." ;; (such as pwd), where the screen is mostly full, consumption can ;; increase by orders of magnitude. +;;; Code: + +(eval-when-compile (require 'eshell)) + +(defgroup eshell-smart nil + "This module combines the facility of normal, modern shells with +some of the edit/review concepts inherent in the design of Plan 9's +9term. See the docs for more details. + +Most likely you will have to turn this option on and play around with +it to get a real sense of how it works." + :tag "Smart display of output" + ;; :link '(info-link "(eshell)Smart display of output") + :group 'eshell-module) + ;;; User Variables: (defcustom eshell-smart-load-hook '(eshell-smart-initialize) @@ -322,7 +322,7 @@ and the end of the buffer are still visible." (if clear (remove-hook 'pre-command-hook 'eshell-smart-display-move t)))) -;;; Code: +(provide 'em-smart) ;;; arch-tag: 8c0112c7-379c-4d54-9a1c-204d68786a4b ;;; em-smart.el ends here diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el index 541773a4b5b..6ee698148da 100644 --- a/lisp/eshell/em-term.el +++ b/lisp/eshell/em-term.el @@ -22,19 +22,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'em-term) - -(eval-when-compile (require 'esh-maint)) - -(defgroup eshell-term nil - "This module causes visual commands (e.g., 'vi') to be executed by -the `term' package, which comes with Emacs. This package handles most -of the ANSI control codes, allowing curses-based applications to run -within an Emacs window. The variable `eshell-visual-commands' defines -which commands are considered visual in nature." - :tag "Running visual commands" - :group 'eshell-module) - ;;; Commentary: ;; At the moment, eshell is stream-based in its interactive input and @@ -45,8 +32,20 @@ which commands are considered visual in nature." ;; buffer, giving the illusion that Eshell itself is allowing these ;; visual processes to execute. +;;; Code: + +(eval-when-compile (require 'eshell)) (require 'term) +(defgroup eshell-term nil + "This module causes visual commands (e.g., 'vi') to be executed by +the `term' package, which comes with Emacs. This package handles most +of the ANSI control codes, allowing curses-based applications to run +within an Emacs window. The variable `eshell-visual-commands' defines +which commands are considered visual in nature." + :tag "Running visual commands" + :group 'eshell-module) + ;;; User Variables: (defcustom eshell-term-load-hook '(eshell-term-initialize) @@ -264,7 +263,7 @@ allowed." ; "Switch to line (\"cooked\") sub-mode of eshell-term mode." ; (use-local-map term-old-mode-map)) -;;; Code: +(provide 'em-term) ;;; arch-tag: ab7c8fe4-3101-4257-925b-1354c6b2fe9d ;;; em-term.el ends here diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 33514d515af..e970c87f501 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el @@ -22,9 +22,22 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'em-unix) +;;; Commentary: + +;; This file contains implementations of several UNIX command in Emacs +;; Lisp, for several reasons: +;; +;; 1) it makes them available on all platforms where the Lisp +;; functions used are available +;; +;; 2) it makes their functionality accessible and modified by the +;; Lisp programmer. +;; +;; 3) it allows Eshell to refrain from having to invoke external +;; processes for common operations. + +;;; Code: -(eval-when-compile (require 'esh-maint)) (require 'eshell) (defgroup eshell-unix nil @@ -40,20 +53,6 @@ by name)." :tag "UNIX commands in Lisp" :group 'eshell-module) -;;; Commentary: - -;; This file contains implementations of several UNIX command in Emacs -;; Lisp, for several reasons: -;; -;; 1) it makes them available on all platforms where the Lisp -;; functions used are available -;; -;; 2) it makes their functionality accessible and modified by the -;; Lisp programmer. -;; -;; 3) it allows Eshell to refrain from having to invoke external -;; processes for common operations. - (defcustom eshell-unix-load-hook '(eshell-unix-initialize) "*A list of functions to run when `eshell-unix' is loaded." :type 'hook @@ -78,7 +77,7 @@ receiving side of a command pipeline." :type 'boolean :group 'eshell-unix) -(defcustom eshell-plain-locate-behavior (eshell-under-xemacs-p) +(defcustom eshell-plain-locate-behavior (featurep 'xemacs) "*If non-nil, standalone \"locate\" commands will behave normally. Standalone in this context means not redirected, and not on the receiving side of a command pipeline." @@ -137,8 +136,6 @@ Otherwise, Emacs will attempt to use rsh to invoke du on the remote machine." :type 'boolean :group 'eshell-unix) -(require 'esh-opt) - ;;; Functions: (defun eshell-unix-initialize () @@ -169,7 +166,7 @@ Otherwise, Emacs will attempt to use rsh to invoke du on the remote machine." (put 'eshell/man 'eshell-no-numeric-conversions t) (defun eshell/info (&rest args) - "Runs the info command in-frame with the same behaviour as command-line `info', ie: + "Run the info command in-frame with the same behavior as command-line `info', ie: 'info' => goes to top info window 'info arg1' => IF arg1 is a file, then visits arg1 'info arg1' => OTHERWISE goes to top info window and then menu item arg1 @@ -1050,7 +1047,7 @@ Show wall-clock time elapsed during execution of COMMAND.") (put 'eshell/occur 'eshell-no-numeric-conversions t) -;;; Code: +(provide 'em-unix) ;;; arch-tag: 2462edd2-a76a-4cf2-897d-92e9a82ac1c9 ;;; em-unix.el ends here diff --git a/lisp/eshell/em-xtra.el b/lisp/eshell/em-xtra.el index bd48afb6bd6..f0a92eb0c60 100644 --- a/lisp/eshell/em-xtra.el +++ b/lisp/eshell/em-xtra.el @@ -22,9 +22,14 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'em-xtra) +;;; Commentary: + +;;; Code: -(eval-when-compile (require 'esh-maint)) +(eval-when-compile + (require 'eshell) + (require 'pcomplete)) +(require 'compile) (defgroup eshell-xtra nil "This module defines some extra alias functions which are entirely @@ -34,10 +39,6 @@ naturally accessible within Emacs." :tag "Extra alias functions" :group 'eshell-module) -;;; Commentary: - -(require 'compile) - ;;; Functions: (defun eshell/expr (&rest args) @@ -117,7 +118,7 @@ naturally accessible within Emacs." (defalias 'pcomplete/bcc 'pcomplete/bcc32) -;;; Code: +(provide 'em-xtra) ;;; arch-tag: f944cfda-a118-470c-a0d6-b41a3a5c99c7 ;;; em-xtra.el ends here diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el index 011e2a55520..7db152d3604 100644 --- a/lisp/eshell/esh-arg.el +++ b/lisp/eshell/esh-arg.el @@ -22,9 +22,15 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. +;;; Commentary: + +;; Parsing of arguments can be extended by adding functions to the +;; hook `eshell-parse-argument-hook'. For a good example of this, see +;; `eshell-parse-drive-letter', defined in eshell-dirs.el. + (provide 'esh-arg) -(eval-when-compile (require 'esh-maint)) +(eval-when-compile (require 'eshell)) (defgroup eshell-arg nil "Argument parsing involves transforming the arguments passed on the @@ -33,12 +39,6 @@ yield the values intended." :tag "Argument parsing" :group 'eshell) -;;; Commentary: - -;; Parsing of arguments can be extended by adding functions to the -;; hook `eshell-parse-argument-hook'. For a good example of this, see -;; `eshell-parse-drive-letter', defined in eshell-dirs.el. - (defcustom eshell-parse-argument-hook (list ;; a term such as #<buffer NAME>, or #<process NAME> is a buffer diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index f999bdcdf6d..247d6c74604 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el @@ -22,18 +22,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'esh-cmd) - -(eval-when-compile (require 'esh-maint)) - -(defgroup eshell-cmd nil - "Executing an Eshell command is as simple as typing it in and -pressing <RET>. There are several different kinds of commands, -however." - :tag "Command invocation" - ;; :link '(info-link "(eshell)Command invocation") - :group 'eshell) - ;;; Commentary: ;;;_* Invoking external commands @@ -64,11 +52,6 @@ however." ;; functions always take precedence, set ;; `eshell-prefer-lisp-functions' to t. -(defcustom eshell-prefer-lisp-functions nil - "*If non-nil, prefer Lisp functions to external commands." - :type 'boolean - :group 'eshell-cmd) - ;;;_* Alias functions ;; ;; Whenever a command is specified using a simple name, such as 'ls', @@ -112,17 +95,44 @@ however." ;; ;; Lisp arguments are identified using the following regexp: +;;;_* Command hooks +;; +;; There are several hooks involved with command execution, which can +;; be used either to change or augment Eshell's behavior. + + +;;; Code: + +(require 'esh-util) +(unless (featurep 'xemacs) + (require 'eldoc)) +(require 'esh-arg) +(require 'esh-proc) +(require 'esh-ext) + +(eval-when-compile + (require 'pcomplete)) + + +(defgroup eshell-cmd nil + "Executing an Eshell command is as simple as typing it in and +pressing <RET>. There are several different kinds of commands, +however." + :tag "Command invocation" + ;; :link '(info-link "(eshell)Command invocation") + :group 'eshell) + +(defcustom eshell-prefer-lisp-functions nil + "*If non-nil, prefer Lisp functions to external commands." + :type 'boolean + :group 'eshell-cmd) + (defcustom eshell-lisp-regexp "\\([(`]\\|#'\\)" "*A regexp which, if matched at beginning of an argument, means Lisp. Such arguments will be passed to `read', and then evaluated." :type 'regexp :group 'eshell-cmd) -;;;_* Command hooks -;; -;; There are several hooks involved with command execution, which can -;; be used either to change or augment Eshell's behavior. - (defcustom eshell-pre-command-hook nil "*A hook run before each interactive command is invoked." :type 'hook @@ -219,15 +229,6 @@ return non-nil if the command is complex." (function :tag "Predicate"))) :group 'eshell-cmd) -;;; Code: - -(require 'esh-util) -(unless (eshell-under-xemacs-p) - (require 'eldoc)) -(require 'esh-arg) -(require 'esh-proc) -(require 'esh-ext) - ;;; User Variables: (defcustom eshell-cmd-load-hook '(eshell-cmd-initialize) @@ -394,6 +395,18 @@ hooks should be run before and after the command." (list 'eshell-commands commands) commands))) +(defun eshell-debug-command (tag subform) + "Output a debugging message to '*eshell last cmd*'." + (let ((buf (get-buffer-create "*eshell last cmd*")) + (text (eshell-stringify eshell-current-command))) + (save-excursion + (set-buffer buf) + (if (not tag) + (erase-buffer) + (insert "\n\C-l\n" tag "\n\n" text + (if subform + (concat "\n\n" (eshell-stringify subform)) "")))))) + (defun eshell-debug-show-parsed-args (terms) "Display parsed arguments in the debug buffer." (ignore @@ -956,18 +969,6 @@ at the moment are: "Completion for the `debug' command." (while (pcomplete-here '("errors" "commands")))) -(defun eshell-debug-command (tag subform) - "Output a debugging message to '*eshell last cmd*'." - (let ((buf (get-buffer-create "*eshell last cmd*")) - (text (eshell-stringify eshell-current-command))) - (save-excursion - (set-buffer buf) - (if (not tag) - (erase-buffer) - (insert "\n\C-l\n" tag "\n\n" text - (if subform - (concat "\n\n" (eshell-stringify subform)) "")))))) - (defun eshell-invoke-directly (command input) (let ((base (cadr (nth 2 (nth 2 (cadr command))))) name) (if (and (eq (car base) 'eshell-trap-errors) @@ -1418,5 +1419,7 @@ messages, and errors." (defalias 'eshell-lisp-command* 'eshell-lisp-command) +(provide 'esh-cmd) + ;;; arch-tag: 8e4f3867-a0c5-441f-96ba-ddd142d94366 ;;; esh-cmd.el ends here diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el index 11090f97b83..b3fc5c30bbe 100644 --- a/lisp/eshell/esh-ext.el +++ b/lisp/eshell/esh-ext.el @@ -22,17 +22,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'esh-ext) - -(eval-when-compile (require 'esh-maint)) -(require 'esh-util) - -(defgroup eshell-ext nil - "External commands are invoked when operating system executables are -loaded into memory, thus beginning a new process." - :tag "External commands" - :group 'eshell) - ;;; Commentary: ;; To force a command to invoked external, either provide an explicit @@ -43,6 +32,18 @@ loaded into memory, thus beginning a new process." ;; /bin/grep ; will definitely invoke /bin/grep ;; *grep ; will also invoke /bin/grep +(provide 'esh-ext) + +(eval-when-compile + (require 'esh-cmd)) +(require 'esh-util) + +(defgroup eshell-ext nil + "External commands are invoked when operating system executables are +loaded into memory, thus beginning a new process." + :tag "External commands" + :group 'eshell) + ;;; User Variables: (defcustom eshell-ext-load-hook '(eshell-ext-initialize) @@ -211,7 +212,7 @@ causing the user to wonder if anything's really going on..." (find-file-name-handler default-directory 'shell-command)))) (if (and handler - (not (and (eshell-under-xemacs-p) + (not (and (featurep 'xemacs) (eq handler 'dired-handler-fn)))) (eshell-remote-command handler command args)) (let ((interp (eshell-find-interpreter command))) diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el index 897f9942d47..15a4af86346 100644 --- a/lisp/eshell/esh-io.el +++ b/lisp/eshell/esh-io.el @@ -22,17 +22,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'esh-io) - -(eval-when-compile (require 'esh-maint)) - -(defgroup eshell-io nil - "Eshell's I/O management code provides a scheme for treating many -different kinds of objects -- symbols, files, buffers, etc. -- as -though they were files." - :tag "I/O management" - :group 'eshell) - ;;; Commentary: ;; At the moment, only output redirection is supported in Eshell. To @@ -68,6 +57,17 @@ though they were files." ;; (+ 1 2) > a > b > c ; prints number to all three files ;; (+ 1 2) > a | wc ; prints to 'a', and pipes to 'wc' +(provide 'esh-io) + +(eval-when-compile (require 'eshell)) + +(defgroup eshell-io nil + "Eshell's I/O management code provides a scheme for treating many +different kinds of objects -- symbols, files, buffers, etc. -- as +though they were files." + :tag "I/O management" + :group 'eshell) + ;;; User Variables: (defcustom eshell-io-load-hook '(eshell-io-initialize) @@ -417,6 +417,10 @@ it defaults to `insert'." (defvar eshell-print-queue nil) (defvar eshell-print-queue-count -1) +(defsubst eshell-print (object) + "Output OBJECT to the standard output handle." + (eshell-output-object object eshell-output-handle)) + (defun eshell-flush (&optional reset-p) "Flush out any lines that have been queued for printing. Must be called before printing begins with -1 as its argument, and @@ -445,10 +449,6 @@ after all printing is over with no argument." (concat eshell-print-queue (apply 'concat strings)) eshell-print-queue-count (1+ eshell-print-queue-count)))) -(defsubst eshell-print (object) - "Output OBJECT to the standard output handle." - (eshell-output-object object eshell-output-handle)) - (defsubst eshell-error (object) "Output OBJECT to the standard error handle." (eshell-output-object object eshell-error-handle)) diff --git a/lisp/eshell/esh-maint.el b/lisp/eshell/esh-maint.el index 61a4ef9510d..3398014ff55 100644 --- a/lisp/eshell/esh-maint.el +++ b/lisp/eshell/esh-maint.el @@ -26,6 +26,8 @@ ;;; Code: +;; This cannot be moved to the end of the file without causing a +;; recursive require during bootstrap. (provide 'esh-maint) (and (fboundp 'font-lock-add-keywords) @@ -35,11 +37,7 @@ ("(eshell-deftest\\>" . font-lock-keyword-face) ("(eshell-condition-case\\>" . font-lock-keyword-face)))) -(if (file-directory-p "../pcomplete") - (add-to-list 'load-path "../pcomplete")) - -(if (locate-library "pcomplete") - (require 'pcomplete)) +(require 'pcomplete nil t) ; why? (eval-when-compile (require 'cl) diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index 8b7338f8833..eb618f6b6b8 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -22,15 +22,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'esh-mode) - -(eval-when-compile (require 'esh-maint)) - -(defgroup eshell-mode nil - "This module contains code for handling input from the user." - :tag "User interface" - :group 'eshell) - ;;; Commentary: ;; Basically, Eshell is used just like shell mode (<M-x shell>). The @@ -68,11 +59,19 @@ ;; ;; @ <C-c C-b> will move backward a complete shell argument. +(provide 'esh-mode) + +(eval-when-compile (require 'esh-util)) (require 'esh-module) (require 'esh-cmd) (require 'esh-io) (require 'esh-var) +(defgroup eshell-mode nil + "This module contains code for handling input from the user." + :tag "User interface" + :group 'eshell) + ;;; User Variables: (defcustom eshell-mode-unload-hook nil @@ -222,11 +221,6 @@ This is used by `eshell-watch-for-password-prompt'." (define-abbrev-table 'eshell-mode-abbrev-table ()) -(eval-when-compile - (unless (eshell-under-xemacs-p) - (defalias 'characterp 'ignore) - (defalias 'char-int 'ignore))) - (if (not eshell-mode-syntax-table) (let ((i 0)) (setq eshell-mode-syntax-table (make-syntax-table)) @@ -269,7 +263,7 @@ This is used by `eshell-watch-for-password-prompt'." (modify-syntax-entry ?\[ "(] " eshell-mode-syntax-table) (modify-syntax-entry ?\] ")[ " eshell-mode-syntax-table) ;; All non-word multibyte characters should be `symbol'. - (if (eshell-under-xemacs-p) + (if (featurep 'xemacs) (map-char-table (function (lambda (key val) @@ -470,7 +464,7 @@ This is used by `eshell-watch-for-password-prompt'." (eshell-deftest mode command-running-p "Modeline shows no command running" - (or (eshell-under-xemacs-p) + (or (featurep 'xemacs) (not eshell-status-in-modeline) (and (memq 'eshell-command-running-string mode-line-format) (equal eshell-command-running-string "--")))) diff --git a/lisp/eshell/esh-module.el b/lisp/eshell/esh-module.el index 17067197909..cf9c2595a87 100644 --- a/lisp/eshell/esh-module.el +++ b/lisp/eshell/esh-module.el @@ -23,11 +23,15 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. +;;; Code: + (provide 'esh-module) (eval-when-compile - (require 'esh-maint) - (require 'cl)) + (require 'cl) + (require 'esh-util)) + +(require 'esh-util) (defgroup eshell-module nil "The `eshell-module' group is for Eshell extension modules, which @@ -36,10 +40,7 @@ customizing the variable `eshell-modules-list'." :tag "Extension modules" :group 'eshell) -;;; Commentary: - -(require 'esh-util) - +(eval-and-compile (defun eshell-load-defgroups (&optional directory) "Load `defgroup' statements from Eshell's module files." (let ((vc-handled-backends nil)) ; avoid VC fucking things up @@ -68,7 +69,9 @@ customizing the variable `eshell-modules-list'." (if defgroup (insert defgroup "\n\n"))) (setq files (cdr files)))) - (save-buffer)))) + ;; Don't make backups, to avoid prompting the user if there are + ;; excess backup versions. + (save-buffer 0))))) ;; load the defgroup's for the standard extension modules, so that ;; documentation can be provided when the user customize's diff --git a/lisp/eshell/esh-opt.el b/lisp/eshell/esh-opt.el index 66310895131..ec2279dff29 100644 --- a/lisp/eshell/esh-opt.el +++ b/lisp/eshell/esh-opt.el @@ -22,9 +22,11 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. +;;; Commentary: + (provide 'esh-opt) -(eval-when-compile (require 'esh-maint)) +(eval-when-compile (require 'esh-ext)) (defgroup eshell-opt nil "The options processing code handles command argument parsing for @@ -32,8 +34,6 @@ Eshell commands implemented in Lisp." :tag "Command options processing" :group 'eshell) -;;; Commentary: - ;;; User Functions: (defmacro eshell-eval-using-options (name macro-args diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el index 7338756e3f8..c679ea7440a 100644 --- a/lisp/eshell/esh-proc.el +++ b/lisp/eshell/esh-proc.el @@ -22,9 +22,13 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. +;;; Commentary: + (provide 'esh-proc) -(eval-when-compile (require 'esh-maint)) +(eval-when-compile + (require 'eshell) + (require 'esh-util)) (defgroup eshell-proc nil "When Eshell invokes external commands, it always does so @@ -33,8 +37,6 @@ finish." :tag "Process management" :group 'eshell) -;;; Commentary: - ;;; User Variables: (defcustom eshell-proc-load-hook '(eshell-proc-initialize) diff --git a/lisp/eshell/esh-test.el b/lisp/eshell/esh-test.el index b4d65fa1f5e..a8e029b629c 100644 --- a/lisp/eshell/esh-test.el +++ b/lisp/eshell/esh-test.el @@ -22,15 +22,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'esh-test) - -(eval-when-compile (require 'esh-maint)) - -(defgroup eshell-test nil - "This module is meant to ensure that Eshell is working correctly." - :tag "Eshell test suite" - :group 'eshell) - ;;; Commentary: ;; The purpose of this module is to verify that Eshell works as @@ -39,8 +30,16 @@ ;;; Code: +(eval-when-compile + (require 'eshell) + (require 'esh-util)) (require 'esh-mode) +(defgroup eshell-test nil + "This module is meant to ensure that Eshell is working correctly." + :tag "Eshell test suite" + :group 'eshell) + ;;; User Variables: (defface eshell-test-ok @@ -236,5 +235,7 @@ "\n")))) nil t)) +(provide 'esh-test) + ;;; arch-tag: 6e32275a-8285-4a4e-b7cf-819aa7c86b8e ;;; esh-test.el ends here diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index 25afdc38506..50243e76032 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el @@ -22,19 +22,15 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'esh-util) +;;; Commentary: -(eval-when-compile (require 'esh-maint)) +;;; Code: (defgroup eshell-util nil "This is general utility code, meant for use by Eshell itself." :tag "General utilities" :group 'eshell) -;;; Commentary: - -(require 'pp) - ;;; User Variables: (defcustom eshell-stringify-t t @@ -139,10 +135,6 @@ function `string-to-number'." ;;; Functions: -(defsubst eshell-under-xemacs-p () - "Return non-nil if we are running under XEmacs." - (boundp 'xemacs-logo)) - (defsubst eshell-under-windows-p () "Return non-nil if we are running under MS-DOS/Windows." (memq system-type '(ms-dos windows-nt))) @@ -433,7 +425,9 @@ list." ;; "args out of range" error in `sit-for', if this function ;; runs while point is in the minibuffer and the users attempt ;; to use completion. Don't ask me. - (ignore-errors (sit-for 0 0))) + (condition-case nil + (sit-for 0 0) + (error nil))) (defun eshell-read-passwd-file (file) "Return an alist correlating gids to group names in FILE." @@ -636,7 +630,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable. (autoload 'parse-time-string "parse-time")) (eval-when-compile - (load "ange-ftp" t)) + (require 'ange-ftp nil t)) (defun eshell-parse-ange-ls (dir) (let (entry) @@ -785,7 +779,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable. ; (or result ; (file-attributes filename)))) -;;; Code: +(provide 'esh-util) ;;; arch-tag: 70159778-5c7a-480a-bae4-3ad332fca19d ;;; esh-util.el ends here diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el index 7c04b5a942a..dbc8802a9c5 100644 --- a/lisp/eshell/esh-var.el +++ b/lisp/eshell/esh-var.el @@ -22,18 +22,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'esh-var) - -(eval-when-compile (require 'esh-maint)) - -(defgroup eshell-var nil - "Variable interpolation is introduced whenever the '$' character -appears unquoted in any argument (except when that argument is -surrounded by single quotes). It may be used to interpolate a -variable value, a subcommand, or even the result of a Lisp form." - :tag "Variable handling" - :group 'eshell) - ;;; Commentary: ;; These are the possible variable interpolation syntaxes. Also keep @@ -118,9 +106,25 @@ variable value, a subcommand, or even the result of a Lisp form." ;; contains the exit code of the last command (0 or 1 for Lisp ;; functions, based on successful completion). +(provide 'esh-var) + +(eval-when-compile + (require 'pcomplete) + (require 'esh-test) + (require 'esh-util) + (require 'esh-opt) + (require 'esh-mode)) (require 'env) (require 'ring) +(defgroup eshell-var nil + "Variable interpolation is introduced whenever the '$' character +appears unquoted in any argument (except when that argument is +surrounded by single quotes). It may be used to interpolate a +variable value, a subcommand, or even the result of a Lisp form." + :tag "Variable handling" + :group 'eshell) + ;;; User Variables: (defcustom eshell-var-load-hook '(eshell-var-initialize) diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el index 23e36149174..58bc72a3ea9 100644 --- a/lisp/eshell/eshell.el +++ b/lisp/eshell/eshell.el @@ -24,21 +24,6 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -(provide 'eshell) - -(eval-when-compile (require 'esh-maint)) - -(defgroup eshell nil - "Eshell is a command shell implemented entirely in Emacs Lisp. It -invokes no external processes beyond those requested by the user. It -is intended to be a functional replacement for command shells such as -bash, zsh, rc, 4dos; since Emacs itself is capable of handling most of -the tasks accomplished by such tools." - :tag "The Emacs shell" - :link '(info-link "(eshell)Top") - :version "21.1" - :group 'applications) - ;;; Commentary: ;;;_* What does Eshell offer you? @@ -73,33 +58,9 @@ the tasks accomplished by such tools." ;; @ Alias functions, both Lisp and Eshell-syntax ;; @ Piping, sequenced commands, background jobs, etc... ;; -;;;_* Eshell is free software -;; -;; Eshell is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. -;; -;; This program is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Eshell; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -;; MA 02110-1301, USA. -;; ;;;_* How to begin ;; -;; To start using Eshell, add the following to your .emacs file: -;; -;; (load "eshell-auto") -;; -;; This will define all of the necessary autoloads. -;; -;; Now type `M-x eshell'. See the INSTALL file for full installation -;; instructions. +;; To start using Eshell, simply type `M-x eshell'. ;; ;;;_* Philosophy ;; @@ -263,12 +224,28 @@ the tasks accomplished by such tools." ;; will only have to read in this one file, which will greatly speed ;; things up. +(eval-when-compile + (require 'cl) + (require 'esh-util)) +(require 'esh-util) +(require 'esh-mode) + +(defgroup eshell nil + "Eshell is a command shell implemented entirely in Emacs Lisp. It +invokes no external processes beyond those requested by the user. It +is intended to be a functional replacement for command shells such as +bash, zsh, rc, 4dos; since Emacs itself is capable of handling most of +the tasks accomplished by such tools." + :tag "The Emacs shell" + :link '(info-link "(eshell)Top") + :version "21.1" + :group 'applications) + + ;;;_* User Options ;; ;; The following user options modify the behavior of Eshell overall. - -(unless (featurep 'esh-util) - (load "esh-util" nil t)) +(defvar eshell-buffer-name) (defsubst eshell-add-to-window-buffer-names () "Add `eshell-buffer-name' to `same-window-buffer-names'." @@ -280,19 +257,19 @@ the tasks accomplished by such tools." (delete eshell-buffer-name same-window-buffer-names))) (defcustom eshell-load-hook nil - "*A hook run once Eshell has been loaded." + "A hook run once Eshell has been loaded." :type 'hook :group 'eshell) (defcustom eshell-unload-hook '(eshell-remove-from-window-buffer-names eshell-unload-all-modules) - "*A hook run when Eshell is unloaded from memory." + "A hook run when Eshell is unloaded from memory." :type 'hook :group 'eshell) (defcustom eshell-buffer-name "*eshell*" - "*The basename used for Eshell buffers." + "The basename used for Eshell buffers." :set (lambda (symbol value) ;; remove the old value of `eshell-buffer-name', if present (if (boundp 'eshell-buffer-name) @@ -309,7 +286,7 @@ the tasks accomplished by such tools." (member eshell-buffer-name same-window-buffer-names)) (defcustom eshell-directory-name (convert-standard-filename "~/.eshell/") - "*The directory where Eshell control files should be kept." + "The directory where Eshell control files should be kept." :type 'directory :group 'eshell) @@ -356,10 +333,8 @@ buffer selected (or created)." ;; `same-window-buffer-names', which is done when Eshell is loaded (assert (and buf (buffer-live-p buf))) (pop-to-buffer buf) - (if (fboundp 'eshell-mode) - (unless (eq major-mode 'eshell-mode) - (eshell-mode)) - (error "`eshell-auto' must be loaded before Eshell can be used")) + (unless (eq major-mode 'eshell-mode) + (eshell-mode)) buf)) (defun eshell-return-exits-minibuffer () @@ -406,7 +381,6 @@ With prefix ARG, insert output into the current buffer at point." (format " >>> #<buffer %s>" (buffer-name (current-buffer)))))) (save-excursion - (require 'esh-mode) (let ((buf (set-buffer (generate-new-buffer " *eshell cmd*"))) (eshell-non-interactive-p t)) (eshell-mode) @@ -465,7 +439,6 @@ corresponding to a successful execution." (if (and status-var (symbolp status-var)) (set status-var 0))) (with-temp-buffer - (require 'esh-mode) (let ((eshell-non-interactive-p t)) (eshell-mode) (let ((result (eshell-do-eval @@ -483,40 +456,12 @@ corresponding to a successful execution." ;;;_* Reporting bugs ;; -;; Since Eshell has not yet been in use by a wide audience, and since -;; the number of possible configurations is quite large, it is certain -;; that many bugs slipped past the rigors of testing it was put -;; through. If you do encounter a bug, on any system, please report +;; If you do encounter a bug, on any system, please report ;; it -- in addition to any particular oddities in your configuration ;; -- so that the problem may be corrected for the benefit of others. -(defconst eshell-report-bug-address "johnw@gnu.org" - "E-mail address to send Eshell bug reports to.") - ;;;###autoload -(defun eshell-report-bug (topic) - "Report a bug in Eshell. -Prompts for the TOPIC. Leaves you in a mail buffer. -Please include any configuration details that might be involved." - (interactive "sBug Subject: ") - (compose-mail eshell-report-bug-address topic) - (goto-char (point-min)) - (re-search-forward (concat "^" (regexp-quote mail-header-separator) "$")) - (forward-line 1) - (let ((signature (buffer-substring (point) (point-max)))) - ;; Discourage users from writing non-English text. - (set-buffer-multibyte nil) - (delete-region (point) (point-max)) - (insert signature) - (backward-char (length signature))) - (insert "emacs-version: " (emacs-version)) - (insert "\n\nThere appears to be a bug in Eshell.\n\n" - "Please describe exactly what actions " - "triggered the bug and the precise\n" - "symptoms of the bug:\n\n") - ;; This is so the user has to type something in order to send - ;; the report easily. - (use-local-map (nconc (make-sparse-keymap) (current-local-map)))) +(define-obsolete-function-alias 'eshell-report-bug 'report-emacs-bug "23.1") ;;; Code: @@ -543,5 +488,7 @@ Emacs." (run-hooks 'eshell-load-hook) +(provide 'eshell) + ;;; arch-tag: 9d4d5214-0e4e-4e02-b349-39add640d63f ;;; eshell.el ends here |