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