13 |
;; not all of these may be required depending on how you use erbot.. |
;; not all of these may be required depending on how you use erbot.. |
14 |
(require 'cl) |
(require 'cl) |
15 |
|
|
16 |
|
;; Compilation |
17 |
|
|
18 |
|
(defvar erball-compilation-paths-rel-to |
19 |
|
(let (args ret) |
20 |
|
(while command-line-args-left |
21 |
|
(if (string= "--paths-rel-to" (car command-line-args-left)) |
22 |
|
(progn |
23 |
|
(setq ret (cadr command-line-args-left)) |
24 |
|
(setq command-line-args-left (cddr command-line-args-left))) |
25 |
|
(add-to-list 'args (car command-line-args-left) t) |
26 |
|
(setq command-line-args-left (cdr command-line-args-left)))) |
27 |
|
(setq command-line-args-left args) |
28 |
|
ret) |
29 |
|
"Text to be prepended to each element in `erball-compilation-paths'. |
30 |
|
Can be specified by passing \"--paths-rel-to ARG\" on the emacs |
31 |
|
command line. |
32 |
|
This value is also added to the load-path. |
33 |
|
A trailing backslash is required.") |
34 |
|
|
35 |
|
(defvar erball-compiling-p |
36 |
|
(if (assoc-string "--compile-erbot" command-line-args-left) |
37 |
|
(progn |
38 |
|
(message (concat "\nCompiling source in " |
39 |
|
(file-name-nondirectory (expand-file-name ".")) |
40 |
|
" ...\n")) |
41 |
|
(setq command-line-args-left |
42 |
|
(delete "--compile-erbot" command-line-args-left)) |
43 |
|
t) |
44 |
|
nil) |
45 |
|
"Determine whether erbot is currently being compiled.") |
46 |
|
|
47 |
|
(defcustom erball-compilation-paths |
48 |
|
'("contrib" |
49 |
|
".." |
50 |
|
"../erc") |
51 |
|
"Elements to add to the load path during compilation. |
52 |
|
If `erball-compilation-paths-rel-to' is specified, it is |
53 |
|
prepended to each element and also added verbatim to the path. |
54 |
|
The current directory is automatically added to the path." |
55 |
|
:group 'erball |
56 |
|
) |
57 |
|
|
58 |
|
(when erball-compiling-p |
59 |
|
(add-to-list 'load-path ".") |
60 |
|
(when erball-compilation-paths-rel-to |
61 |
|
(add-to-list 'load-path erball-compilation-paths-rel-to)) |
62 |
|
(dolist (dir erball-compilation-paths) |
63 |
|
(add-to-list 'load-path |
64 |
|
(concat erball-compilation-paths-rel-to dir)))) |
65 |
|
|
66 |
|
;; Load all erbot files |
67 |
|
|
68 |
(defmacro erball-ignore-errors-loudly (&rest body) |
(defmacro erball-ignore-errors-loudly (&rest body) |
69 |
"Like ignore-errors, but tells the error.. |
"Like ignore-errors, but tells the error.. |
70 |
|
|
123 |
|
|
124 |
;; the rest of the commands here are useful to the author when editing erbot. |
;; the rest of the commands here are useful to the author when editing erbot. |
125 |
|
|
126 |
(defcustom erball-files |
(defcustom erball-files |
127 |
'("erbot.el" |
(if erball-compiling-p |
128 |
"erbutils.el" |
(directory-files "." nil "\.el$") |
129 |
"erblog.el" |
'("erbot.el" |
130 |
"erbeng.el" |
"erbutils.el" |
131 |
"erbcountry.el" |
"erblog.el" |
132 |
"erbdata.el" |
"erbeng.el" |
133 |
"erbedit.el" |
"erbcountry.el" |
134 |
"erbforget.el" |
"erbdata.el" |
135 |
"erbkarma.el" |
"erbedit.el" |
136 |
"erblisp.el" |
"erbforget.el" |
137 |
"erbunlisp.el" |
"erbkarma.el" |
138 |
"erbtrain.el" |
"erblisp.el" |
139 |
"erbwiki.el" |
"erbunlisp.el" |
140 |
"erbc.el" |
"erbtrain.el" |
141 |
"erbc2.el" |
"erbwiki.el" |
142 |
"erbc3.el" |
"erbc.el" |
143 |
"erbc4.el" |
"erbc2.el" |
144 |
"erbc5.el" |
"erbc3.el" |
145 |
"erbc6.el" |
"erbc4.el" |
146 |
) |
"erbc5.el" |
147 |
|
"erbc6.el" |
148 |
|
)) |
149 |
|
|
150 |
"" |
"" |
151 |
:group 'erball |
:group 'erball |
153 |
|
|
154 |
(defun erball-reload () |
(defun erball-reload () |
155 |
(interactive) |
(interactive) |
156 |
(mapcar |
(mapcar |
157 |
'load |
'load |
158 |
erball-files)) |
erball-files)) |
159 |
|
|
160 |
(defun erball-visit () |
(defun erball-visit () |
161 |
(interactive) |
(interactive) |
162 |
(mapcar |
(mapcar |
163 |
(lambda (a) |
(lambda (a) |
164 |
(find-file (locate-library a)) |
(find-file (locate-library a)) |
165 |
(auto-revert-mode 1)) |
(auto-revert-mode 1)) |
168 |
;;;###autoload |
;;;###autoload |
169 |
(defun erball-compile () |
(defun erball-compile () |
170 |
(interactive) |
(interactive) |
171 |
(ignore-errors (kill-buffer "*Compile-Log*")) |
(if erball-compiling-p |
172 |
(erball-visit) |
(progn |
173 |
(erball-reload) |
(ignore-errors (erball-reload)) |
174 |
(mapcar |
(mapcar |
175 |
(lambda (arg) |
(lambda (arg) |
176 |
(byte-compile-file (locate-library arg))) |
(erball-ignore-errors-loudly |
177 |
erball-files) |
(byte-compile-file arg))) |
178 |
(switch-to-buffer "*Compile-Log*") |
erball-files) |
179 |
(delete-other-windows) |
(message "\nCompilation complete!\n")) |
180 |
(goto-char (point-min))) |
(ignore-errors (kill-buffer "*Compile-Log*")) |
181 |
|
(erball-visit) |
182 |
|
(erball-reload) |
183 |
|
(mapcar |
184 |
|
(lambda (arg) |
185 |
|
(erball-ignore-errors-loudly |
186 |
|
(byte-compile-file (locate-library arg)))) |
187 |
|
erball-files) |
188 |
|
(switch-to-buffer "*Compile-Log*") |
189 |
|
(delete-other-windows) |
190 |
|
(goto-char (point-min)))) |
191 |
|
|
192 |
|
|
193 |
(provide 'erball) |
(provide 'erball) |
|
|
|
|
|
|