Mercurial > emacs
annotate lisp/eshell/esh-module.el @ 37569:44748506225d
(cperl-font-lock-keywords)
(cperl-font-lock-keywords-1, cperl-font-lock-keywords-2):
Renamed from perl-font-lock-keywords to avoid clashes.
(cperl-mode, cperl-load-font-lock-keywords, cperl-init-faces)
(cperl-load-font-lock-keywords-1, cperl-load-font-lock-keywords-2):
Updated correspondingly.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 04 May 2001 20:16:47 +0000 |
parents | e21feeab77fb |
children | 67b464da13ec |
rev | line source |
---|---|
29876 | 1 ;;; esh-module --- Eshell modules |
2 | |
29934
34b1ab9d583d
Change spelling of the Free Software Foundation.
Gerd Moellmann <gerd@gnu.org>
parents:
29898
diff
changeset
|
3 ;; Copyright (C) 1999, 2000 Free Software Foundation |
29876 | 4 |
29898
8f071fd1161d
Require CL when compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29876
diff
changeset
|
5 ;; Author: John Wiegley <johnw@gnu.org> |
8f071fd1161d
Require CL when compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29876
diff
changeset
|
6 ;; Keywords: processes |
8f071fd1161d
Require CL when compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29876
diff
changeset
|
7 |
29876 | 8 ;; This file is part of GNU Emacs. |
9 | |
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 2, or (at your option) | |
13 ;; any later version. | |
14 | |
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. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
24 | |
25 (provide 'esh-module) | |
26 | |
33020 | 27 (eval-when-compile |
28 (require 'esh-maint) | |
29 (require 'cl)) | |
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 ;;; Commentary: | |
39 | |
40 (require 'esh-util) | |
41 | |
42 (defun eshell-load-defgroups (&optional directory) | |
43 "Load `defgroup' statements from Eshell's module files." | |
44 (with-current-buffer | |
45 (find-file-noselect (expand-file-name "esh-groups.el" directory)) | |
46 (erase-buffer) | |
47 (insert ";;; do not modify this file; it is auto-generated\n\n") | |
48 (let ((files (directory-files (or directory | |
49 (car command-line-args-left)) | |
50 nil "\\`em-.*\\.el\\'"))) | |
51 (while files | |
52 (message "Loading defgroup from `%s'" (car files)) | |
53 (let (defgroup) | |
54 (catch 'handled | |
55 (with-current-buffer (find-file-noselect (car files)) | |
56 (goto-char (point-min)) | |
57 (while t | |
58 (forward-sexp) | |
59 (if (eobp) (throw 'handled t)) | |
60 (backward-sexp) | |
61 (let ((begin (point)) | |
62 (defg (looking-at "(defgroup"))) | |
63 (forward-sexp) | |
64 (if defg | |
65 (setq defgroup (buffer-substring begin (point)))))))) | |
66 (if defgroup | |
67 (insert defgroup "\n\n"))) | |
68 (setq files (cdr files)))) | |
69 (save-buffer))) | |
70 | |
71 ;; load the defgroup's for the standard extension modules, so that | |
72 ;; documentation can be provided when the user customize's | |
73 ;; `eshell-modules-list'. | |
74 (eval-when-compile | |
30141 | 75 (when (and (boundp 'byte-compile-current-file) |
76 byte-compile-current-file | |
31327
02375e0f6ea7
(eval-when-compile): Don't lose if esh-module.el's file name
Eli Zaretskii <eliz@gnu.org>
parents:
30141
diff
changeset
|
77 (or |
02375e0f6ea7
(eval-when-compile): Don't lose if esh-module.el's file name
Eli Zaretskii <eliz@gnu.org>
parents:
30141
diff
changeset
|
78 (equal (file-name-nondirectory byte-compile-current-file) |
02375e0f6ea7
(eval-when-compile): Don't lose if esh-module.el's file name
Eli Zaretskii <eliz@gnu.org>
parents:
30141
diff
changeset
|
79 "esh-module.el") |
02375e0f6ea7
(eval-when-compile): Don't lose if esh-module.el's file name
Eli Zaretskii <eliz@gnu.org>
parents:
30141
diff
changeset
|
80 ;; When eshell file names are expanded from a wildcard |
02375e0f6ea7
(eval-when-compile): Don't lose if esh-module.el's file name
Eli Zaretskii <eliz@gnu.org>
parents:
30141
diff
changeset
|
81 ;; or by reading the Eshell directory, e.g. when they |
02375e0f6ea7
(eval-when-compile): Don't lose if esh-module.el's file name
Eli Zaretskii <eliz@gnu.org>
parents:
30141
diff
changeset
|
82 ;; say "make recompile" in the lisp directory, Emacs on |
02375e0f6ea7
(eval-when-compile): Don't lose if esh-module.el's file name
Eli Zaretskii <eliz@gnu.org>
parents:
30141
diff
changeset
|
83 ;; MS-DOS sees a truncated name "esh-modu.el" instead of |
02375e0f6ea7
(eval-when-compile): Don't lose if esh-module.el's file name
Eli Zaretskii <eliz@gnu.org>
parents:
30141
diff
changeset
|
84 ;; "esh-module.el". |
02375e0f6ea7
(eval-when-compile): Don't lose if esh-module.el's file name
Eli Zaretskii <eliz@gnu.org>
parents:
30141
diff
changeset
|
85 (and (fboundp 'msdos-long-file-names) |
02375e0f6ea7
(eval-when-compile): Don't lose if esh-module.el's file name
Eli Zaretskii <eliz@gnu.org>
parents:
30141
diff
changeset
|
86 (null (msdos-long-file-names)) |
02375e0f6ea7
(eval-when-compile): Don't lose if esh-module.el's file name
Eli Zaretskii <eliz@gnu.org>
parents:
30141
diff
changeset
|
87 (equal (file-name-nondirectory byte-compile-current-file) |
02375e0f6ea7
(eval-when-compile): Don't lose if esh-module.el's file name
Eli Zaretskii <eliz@gnu.org>
parents:
30141
diff
changeset
|
88 "esh-modu.el")))) |
29876 | 89 (let* ((directory (file-name-directory byte-compile-current-file)) |
33020 | 90 (elc-file (expand-file-name "esh-groups.elc" directory))) |
29876 | 91 (eshell-load-defgroups directory) |
92 (if (file-exists-p elc-file) (delete-file elc-file))))) | |
93 | |
94 (load "esh-groups" t t) | |
95 | |
96 ;;; User Variables: | |
97 | |
98 (defcustom eshell-module-unload-hook | |
99 '(eshell-unload-extension-modules) | |
100 "*A hook run when `eshell-module' is unloaded." | |
101 :type 'hook | |
102 :group 'eshell-module) | |
103 | |
104 (defcustom eshell-modules-list | |
105 '(eshell-alias | |
106 eshell-banner | |
107 eshell-basic | |
108 eshell-cmpl | |
109 eshell-dirs | |
110 eshell-glob | |
111 eshell-hist | |
112 eshell-ls | |
113 eshell-pred | |
114 eshell-prompt | |
115 eshell-script | |
116 eshell-term | |
117 eshell-unix) | |
118 "*A list of optional add-on modules to be loaded by Eshell. | |
119 Changes will only take effect in future Eshell buffers." | |
120 :type (append | |
121 (list 'set ':tag "Supported modules") | |
122 (mapcar | |
123 (function | |
124 (lambda (modname) | |
125 (let ((modsym (intern modname))) | |
126 (list 'const | |
127 ':tag (format "%s -- %s" modname | |
128 (get modsym 'custom-tag)) | |
129 ':link (caar (get modsym 'custom-links)) | |
130 ':doc (concat "\n" (get modsym 'group-documentation) | |
131 "\n ") | |
132 modsym)))) | |
133 (sort (mapcar 'symbol-name | |
134 (eshell-subgroups 'eshell-module)) | |
135 'string-lessp)) | |
136 '((repeat :inline t :tag "Other modules" symbol))) | |
137 :group 'eshell-module) | |
138 | |
139 ;;; Code: | |
140 | |
141 (defsubst eshell-using-module (module) | |
142 "Return non-nil if a certain Eshell MODULE is in use. | |
143 The MODULE should be a symbol corresponding to that module's | |
144 customization group. Example: `eshell-cmpl' for that module." | |
145 (memq module eshell-modules-list)) | |
146 | |
147 (defun eshell-unload-extension-modules () | |
148 "Unload any memory resident extension modules." | |
149 (eshell-for module (eshell-subgroups 'eshell-module) | |
150 (if (featurep module) | |
151 (ignore-errors | |
152 (message "Unloading %s..." (symbol-name module)) | |
153 (unload-feature module) | |
154 (message "Unloading %s...done" (symbol-name module)))))) | |
155 | |
156 ;;; esh-module.el ends here |