* lisp/faces.el (success): Change face color from "Green3" to
[emacs.git] / lisp / eshell / esh-module.el
blob1581d05889edc282b0e9e50e06733b27fa81077b
1 ;;; esh-module.el --- Eshell modules
3 ;; Copyright (C) 1999-2000, 2002-2011 Free Software Foundation, Inc.
5 ;; Author: John Wiegley <johnw@gnu.org>
6 ;; Keywords: processes
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23 ;;; Code:
25 (provide 'esh-module)
27 (require 'eshell)
28 (require 'esh-util)
30 (defgroup eshell-module nil
31 "The `eshell-module' group is for Eshell extension modules, which
32 provide optional behavior which the user can enable or disable by
33 customizing the variable `eshell-modules-list'."
34 :tag "Extension modules"
35 :group 'eshell)
37 ;; load the defgroup's for the standard extension modules, so that
38 ;; documentation can be provided when the user customize's
39 ;; `eshell-modules-list'.
40 (load "esh-groups" nil 'nomessage)
42 ;;; User Variables:
44 (defcustom eshell-module-unload-hook
45 '(eshell-unload-extension-modules)
46 "A hook run when `eshell-module' is unloaded."
47 :type 'hook
48 :group 'eshell-module)
50 (defcustom eshell-modules-list
51 '(eshell-alias
52 eshell-banner
53 eshell-basic
54 eshell-cmpl
55 eshell-dirs
56 eshell-glob
57 eshell-hist
58 eshell-ls
59 eshell-pred
60 eshell-prompt
61 eshell-script
62 eshell-term
63 eshell-unix)
64 "A list of optional add-on modules to be loaded by Eshell.
65 Changes will only take effect in future Eshell buffers."
66 :type (append
67 (list 'set ':tag "Supported modules")
68 (mapcar
69 (function
70 (lambda (modname)
71 (let ((modsym (intern modname)))
72 (list 'const
73 ':tag (format "%s -- %s" modname
74 (get modsym 'custom-tag))
75 ':link (caar (get modsym 'custom-links))
76 ':doc (concat "\n" (get modsym 'group-documentation)
77 "\n ")
78 modsym))))
79 (sort (mapcar 'symbol-name
80 (eshell-subgroups 'eshell-module))
81 'string-lessp))
82 '((repeat :inline t :tag "Other modules" symbol)))
83 :group 'eshell-module)
85 ;;; Code:
87 (defsubst eshell-using-module (module)
88 "Return non-nil if a certain Eshell MODULE is in use.
89 The MODULE should be a symbol corresponding to that module's
90 customization group. Example: `eshell-cmpl' for that module."
91 (memq module eshell-modules-list))
93 (defun eshell-unload-extension-modules ()
94 "Unload any memory resident extension modules."
95 (dolist (module (eshell-subgroups 'eshell-module))
96 (if (featurep module)
97 (ignore-errors
98 (message "Unloading %s..." (symbol-name module))
99 (unload-feature module)
100 (message "Unloading %s...done" (symbol-name module))))))
102 ;;; esh-module.el ends here