1 ;;; esh-module.el --- Eshell modules
3 ;; Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007,
4 ;; 2008, 2009, 2010 Free Software Foundation, Inc.
6 ;; Author: John Wiegley <johnw@gnu.org>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
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.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
31 (defgroup eshell-module nil
32 "The `eshell-module' group is for Eshell extension modules, which
33 provide optional behavior which the user can enable or disable by
34 customizing the variable `eshell-modules-list'."
35 :tag
"Extension modules"
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'.
41 (load "esh-groups" nil
'nomessage
)
45 (defcustom eshell-module-unload-hook
46 '(eshell-unload-extension-modules)
47 "*A hook run when `eshell-module' is unloaded."
49 :group
'eshell-module
)
51 (defcustom eshell-modules-list
65 "*A list of optional add-on modules to be loaded by Eshell.
66 Changes will only take effect in future Eshell buffers."
68 (list 'set
':tag
"Supported modules")
72 (let ((modsym (intern modname
)))
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
)
80 (sort (mapcar 'symbol-name
81 (eshell-subgroups 'eshell-module
))
83 '((repeat :inline t
:tag
"Other modules" symbol
)))
84 :group
'eshell-module
)
88 (defsubst eshell-using-module
(module)
89 "Return non-nil if a certain Eshell MODULE is in use.
90 The MODULE should be a symbol corresponding to that module's
91 customization group. Example: `eshell-cmpl' for that module."
92 (memq module eshell-modules-list
))
94 (defun eshell-unload-extension-modules ()
95 "Unload any memory resident extension modules."
96 (eshell-for module
(eshell-subgroups 'eshell-module
)
99 (message "Unloading %s..." (symbol-name module
))
100 (unload-feature module
)
101 (message "Unloading %s...done" (symbol-name module
))))))
103 ;; arch-tag: 97a3fa16-9d08-40e6-bc2c-36bd70986507
104 ;;; esh-module.el ends here