1 |
;;; esh-module.el --- Eshell modules |
;;; esh-module.el --- Eshell modules |
2 |
|
|
3 |
;; Copyright (C) 1999, 2000 Free Software Foundation |
;; Copyright (C) 1999, 2000, 2004 Free Software Foundation |
4 |
|
|
5 |
;; Author: John Wiegley <johnw@gnu.org> |
;; Author: John Wiegley <johnw@gnu.org> |
6 |
;; Keywords: processes |
;; Keywords: processes |
41 |
|
|
42 |
(defun eshell-load-defgroups (&optional directory) |
(defun eshell-load-defgroups (&optional directory) |
43 |
"Load `defgroup' statements from Eshell's module files." |
"Load `defgroup' statements from Eshell's module files." |
44 |
(with-current-buffer |
(let ((vc-handled-backends nil)) ; avoid VC fucking things up |
45 |
(find-file-noselect (expand-file-name "esh-groups.el" directory)) |
(with-current-buffer |
46 |
(erase-buffer) |
(find-file-noselect (expand-file-name "esh-groups.el" directory)) |
47 |
(insert ";;; do not modify this file; it is auto-generated -*- no-byte-compile: t -*-\n\n") |
(erase-buffer) |
48 |
(let ((files (directory-files (or directory |
(insert ";;; do not modify this file; it is auto-generated -*- no-byte-compile: t -*-\n\n") |
49 |
(car command-line-args-left)) |
(let ((files (directory-files (or directory |
50 |
nil "\\`em-.*\\.el\\'"))) |
(car command-line-args-left)) |
51 |
(while files |
nil "\\`em-.*\\.el\\'"))) |
52 |
(message "Loading defgroup from `%s'" (car files)) |
(while files |
53 |
(let (defgroup) |
(message "Loading defgroup from `%s'" (car files)) |
54 |
(catch 'handled |
(let (defgroup) |
55 |
(with-current-buffer (find-file-noselect (car files)) |
(catch 'handled |
56 |
(goto-char (point-min)) |
(with-current-buffer (find-file-noselect (car files)) |
57 |
(while t |
(goto-char (point-min)) |
58 |
(forward-sexp) |
(while t |
|
(if (eobp) (throw 'handled t)) |
|
|
(backward-sexp) |
|
|
(let ((begin (point)) |
|
|
(defg (looking-at "(defgroup"))) |
|
59 |
(forward-sexp) |
(forward-sexp) |
60 |
(if defg |
(if (eobp) (throw 'handled t)) |
61 |
(setq defgroup (buffer-substring begin (point)))))))) |
(backward-sexp) |
62 |
(if defgroup |
(let ((begin (point)) |
63 |
(insert defgroup "\n\n"))) |
(defg (looking-at "(defgroup"))) |
64 |
(setq files (cdr files)))) |
(forward-sexp) |
65 |
(save-buffer))) |
(if defg |
66 |
|
(setq defgroup (buffer-substring begin (point)))))))) |
67 |
|
(if defgroup |
68 |
|
(insert defgroup "\n\n"))) |
69 |
|
(setq files (cdr files)))) |
70 |
|
(save-buffer)))) |
71 |
|
|
72 |
;; load the defgroup's for the standard extension modules, so that |
;; load the defgroup's for the standard extension modules, so that |
73 |
;; documentation can be provided when the user customize's |
;; documentation can be provided when the user customize's |