Mercurial > emacs
annotate lisp/eshell/esh-module.el @ 96498:1f27a4bf06f5
Merge from gnus--devo--0
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1309
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 04 Jul 2008 00:07:47 +0000 |
parents | 1b1b163d3028 |
children | a9dc0e7c3f2b |
rev | line source |
---|---|
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
33020
diff
changeset
|
1 ;;; esh-module.el --- Eshell modules |
29876 | 2 |
95149
1b1b163d3028
No need for cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
94661
diff
changeset
|
3 ;; Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, |
1b1b163d3028
No need for cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
94661
diff
changeset
|
4 ;; 2008 Free Software Foundation, Inc. |
29876 | 5 |
29898
8f071fd1161d
Require CL when compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29876
diff
changeset
|
6 ;; Author: John Wiegley <johnw@gnu.org> |
8f071fd1161d
Require CL when compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29876
diff
changeset
|
7 ;; Keywords: processes |
8f071fd1161d
Require CL when compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29876
diff
changeset
|
8 |
29876 | 9 ;; This file is part of GNU Emacs. |
10 | |
94661
b5b0801a7637
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
29876 | 12 ;; it under the terms of the GNU General Public License as published by |
94661
b5b0801a7637
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
b5b0801a7637
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; (at your option) any later version. |
29876 | 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 | |
94661
b5b0801a7637
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
29876 | 23 |
87081
24280fb751e3
Require individual files if needed when compiling, rather than
Glenn Morris <rgm@gnu.org>
parents:
86198
diff
changeset
|
24 ;;; Code: |
24280fb751e3
Require individual files if needed when compiling, rather than
Glenn Morris <rgm@gnu.org>
parents:
86198
diff
changeset
|
25 |
29876 | 26 (provide 'esh-module) |
27 | |
95149
1b1b163d3028
No need for cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
94661
diff
changeset
|
28 (require 'eshell) |
87081
24280fb751e3
Require individual files if needed when compiling, rather than
Glenn Morris <rgm@gnu.org>
parents:
86198
diff
changeset
|
29 (require 'esh-util) |
29876 | 30 |
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" | |
36 :group 'eshell) | |
37 | |
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'. | |
95149
1b1b163d3028
No need for cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
94661
diff
changeset
|
41 (require 'esh-groups) |
29876 | 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. | |
66 Changes 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. | |
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)) | |
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 | |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
103 ;; arch-tag: 97a3fa16-9d08-40e6-bc2c-36bd70986507 |
29876 | 104 ;;; esh-module.el ends here |