Commit | Line | Data |
---|---|---|
6be19e60 | 1 | ;;; cus-test.el --- tests for custom types and load problems |
82e74860 MR |
2 | |
3 | ;; Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc. | |
4 | ||
5 | ;; Author: Markus Rost <markus.rost@mathematik.uni-regensburg.de> | |
6 | ;; Maintainer: Markus Rost <rost@math.ohio-state.edu> | |
7 | ;; Created: 13 Sep 1998 | |
8 | ;; Keywords: maint | |
9 | ||
10 | ;; This file is part of GNU Emacs. | |
11 | ||
12 | ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 | ;; it under the terms of the GNU General Public License as published by | |
14 | ;; the Free Software Foundation; either version 2, or (at your option) | |
15 | ;; any later version. | |
16 | ||
17 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ;; GNU General Public License for more details. | |
21 | ||
22 | ;; You should have received a copy of the GNU General Public License | |
23 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
24 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 | ;; Boston, MA 02111-1307, USA. | |
26 | ||
27 | ;;; Commentary: | |
28 | ||
6be19e60 MR |
29 | ;; This file provides simple tests to detect custom options with |
30 | ;; incorrect customization types and load problems for custom and | |
31 | ;; autoload dependencies. | |
82e74860 | 32 | ;; |
6be19e60 MR |
33 | ;; The basic tests can be run in batch mode. Invoke them with |
34 | ;; | |
35 | ;; src/emacs -batch -l admin/cus-test.el -f cus-test-opts | |
36 | ;; | |
37 | ;; src/emacs -batch -l admin/cus-test.el -f cus-test-deps | |
38 | ;; | |
39 | ;; src/emacs -batch -l admin/cus-test.el -f cus-test-libs | |
40 | ;; | |
002cba79 MR |
41 | ;; src/emacs -batch -l admin/cus-test.el -f cus-test-noloads |
42 | ;; | |
6be19e60 MR |
43 | ;; in the emacs source directory. |
44 | ;; | |
45 | ;; For interactive use: Load this file. Then | |
82e74860 MR |
46 | ;; |
47 | ;; M-x cus-test-apropos REGEXP RET | |
48 | ;; | |
49 | ;; checks the options matching REGEXP. In particular | |
50 | ;; | |
51 | ;; M-x cus-test-apropos RET | |
52 | ;; | |
53 | ;; checks all options. The detected options are stored in the | |
54 | ;; variable `cus-test-errors'. | |
55 | ;; | |
56 | ;; Only those options are checked which have been already loaded. | |
57 | ;; Therefore `cus-test-apropos' is more efficient after loading many | |
58 | ;; libraries. | |
59 | ;; | |
6be19e60 MR |
60 | ;; M-x cus-test-load-custom-loads |
61 | ;; | |
62 | ;; loads all (!) custom dependencies and | |
82e74860 | 63 | ;; |
6be19e60 MR |
64 | ;; M-x cus-test-load-libs |
65 | ;; | |
66 | ;; loads all (!) libraries with autoloads. | |
82e74860 | 67 | ;; |
82e74860 | 68 | ;; Options with a custom-get property, usually defined by a :get |
bd08d86a MR |
69 | ;; declaration, are stored in the variable |
70 | ;; | |
71 | ;; `cus-test-vars-with-custom-get' | |
72 | ;; | |
73 | ;; Options with a state of 'changed ("changed outside the customize | |
74 | ;; buffer") are stored in the variable | |
75 | ;; | |
76 | ;; `cus-test-vars-with-changed-state' | |
77 | ;; | |
78 | ;; These lists are prepared just in case one wants to investigate | |
79 | ;; those options further. | |
80 | ;; | |
6be19e60 | 81 | ;; The command `cus-test-opts' tests many (all?) custom options. |
bd08d86a | 82 | ;; |
6be19e60 MR |
83 | ;; The command `cus-test-deps' is like `cus-test-load-custom-loads' |
84 | ;; but reports about load errors. | |
592cd48b | 85 | ;; |
6be19e60 MR |
86 | ;; The command `cus-test-libs' runs for all libraries with autoloads |
87 | ;; separate emacs processes of the form "emacs -batch -l LIB". | |
592cd48b | 88 | ;; |
002cba79 MR |
89 | ;; The command `cus-test-noloads' returns a list of variables which |
90 | ;; are somewhere declared as custom options, but not loaded by | |
91 | ;; `custom-load-symbol'. | |
92 | ;; | |
6be19e60 | 93 | ;; Some results from October 2002: |
592cd48b | 94 | ;; |
6be19e60 MR |
95 | ;; 4523 options tested |
96 | ;; The following variables might have problems: | |
97 | ;; ps-mule-font-info-database-default | |
bf7a63e1 MR |
98 | ;; grep-tree-command |
99 | ;; grep-find-command | |
592cd48b | 100 | ;; |
6be19e60 MR |
101 | ;; 288 features required |
102 | ;; 10 files loaded | |
103 | ;; The following load problems appeared: | |
bf7a63e1 | 104 | ;; (killing x-win (file-error Cannot open load file x-win)) |
6be19e60 | 105 | ;; Symbol faces has loaddefs as custom dependency |
95dc5eeb MR |
106 | ;; (reftex-index-support reftex-vars (void-function reftex-set-dirty)) |
107 | ;; (eshell-script em-script (void-variable eshell-directory-name)) | |
108 | ;; (pcomplete em-cmpl (void-function eshell-under-windows-p)) | |
109 | ;; (eshell-ext esh-ext (void-function eshell-under-windows-p)) | |
6be19e60 | 110 | ;; ... |
592cd48b | 111 | ;; |
6be19e60 | 112 | ;; 422 libraries had no load errors |
592cd48b | 113 | ;; The following load problems appeared: |
6be19e60 | 114 | ;; (eudc-export error 255) |
95dc5eeb MR |
115 | ;; (ada-xref error 255) |
116 | ;; (ada-stmt error 255) | |
002cba79 MR |
117 | ;; |
118 | ;; The following options were not loaded by custom-load-symbol: | |
119 | ;; edt-bottom-scroll-margin | |
120 | ;; edt-keep-current-page-delimiter | |
121 | ;; edt-top-scroll-margin | |
122 | ;; edt-use-EDT-control-key-bindings | |
123 | ;; edt-word-entities | |
124 | ;; grep-find-use-xargs | |
125 | ;; master-mode-hook | |
126 | ;; outline-level | |
127 | ;; outline-minor-mode-hook | |
128 | ;; refill-mode-hook | |
82e74860 | 129 | |
e170d16c | 130 | \f |
592cd48b | 131 | ;;; Code: |
82e74860 | 132 | |
6be19e60 | 133 | ;;; Workarounds. For a smooth run and to avoid some side effects. |
82e74860 | 134 | |
bd08d86a | 135 | (defvar cus-test-after-load-libs-hook nil |
6be19e60 MR |
136 | "Used to switch off undesired side effects of loading libraries.") |
137 | ||
138 | (defvar cus-test-skip-list nil | |
139 | "List of variables to disregard by `cus-test-apropos'.") | |
bd08d86a | 140 | |
002cba79 | 141 | (defvar cus-test-libs-noloads nil |
6be19e60 MR |
142 | "List of libraries not to load by `cus-test-load-libs'.") |
143 | ||
144 | ;; The file eudc-export.el loads libraries "bbdb" and "bbdb-com" which | |
145 | ;; are not part of GNU Emacs: (locate-library "bbdb") => nil | |
146 | ;; We avoid the resulting errors from loading eudc-export.el: | |
147 | (provide 'bbdb) | |
148 | (provide 'bbdb-com) | |
82e74860 | 149 | |
6be19e60 MR |
150 | ;; This avoids a hang of `cus-test-apropos' in 21.2. |
151 | ;; (add-to-list 'cus-test-skip-list 'sh-alias-alist) | |
82e74860 | 152 | |
592cd48b | 153 | ;; Loading dunnet in batch mode leads to a Dead end. |
6be19e60 | 154 | (let (noninteractive) (load "dunnet")) |
002cba79 | 155 | (add-to-list 'cus-test-libs-noloads "dunnet") |
592cd48b | 156 | |
6be19e60 MR |
157 | ;; Never Viperize. |
158 | (setq viper-mode nil) | |
82e74860 | 159 | |
592cd48b | 160 | ;; Don't create a file `save-place-file'. |
82e74860 MR |
161 | (eval-after-load "saveplace" |
162 | '(remove-hook 'kill-emacs-hook 'save-place-kill-emacs-hook)) | |
163 | ||
592cd48b | 164 | ;; Don't create a file `abbrev-file-name'. |
82e74860 MR |
165 | (setq save-abbrevs nil) |
166 | ||
167 | ;; Avoid compile logs from adviced functions. | |
168 | (eval-after-load "bytecomp" | |
169 | '(setq ad-default-compilation-action 'never)) | |
170 | ||
6be19e60 MR |
171 | \f |
172 | ;;; Main code: | |
173 | ||
82e74860 MR |
174 | ;; We want to log all messages. |
175 | (setq message-log-max t) | |
176 | ||
592cd48b MR |
177 | (require 'cus-edit) |
178 | (require 'cus-load) | |
179 | ||
82e74860 MR |
180 | (defvar cus-test-errors nil |
181 | "List of problematic variables found by `cus-test-apropos'.") | |
182 | ||
6be19e60 MR |
183 | (defvar cus-test-tested-variables nil |
184 | "List of options tested by last call of `cus-test-apropos'.") | |
185 | ||
002cba79 MR |
186 | ;; I haven't understood this :get stuff. The symbols with a |
187 | ;; custom-get property are stored here. | |
188 | (defvar cus-test-vars-with-custom-get nil | |
189 | "Set by `cus-test-apropos' to a list of options with :get property.") | |
190 | ||
191 | (defvar cus-test-vars-with-changed-state nil | |
192 | "Set by `cus-test-apropos' to a list of options with state 'changed.") | |
193 | ||
592cd48b MR |
194 | (defvar cus-test-deps-errors nil |
195 | "List of require/load problems found by `cus-test-deps'.") | |
196 | ||
6be19e60 MR |
197 | (defvar cus-test-deps-required nil |
198 | "List of dependencies required by `cus-test-deps'. | |
199 | Only unloaded features will be require'd.") | |
200 | ||
bd9aba20 | 201 | (defvar cus-test-deps-loaded nil |
6be19e60 | 202 | "List of dependencies loaded by `cus-test-deps'.") |
592cd48b MR |
203 | |
204 | (defvar cus-test-libs-errors nil | |
6be19e60 | 205 | "List of load problems found by `cus-test-load-libs' or `cus-test-libs'.") |
592cd48b MR |
206 | |
207 | (defvar cus-test-libs-loaded nil | |
6be19e60 | 208 | "List of files loaded by `cus-test-load-libs' or `cus-test-libs'.") |
592cd48b | 209 | |
002cba79 MR |
210 | (defvar cus-test-vars-not-cus-loaded nil |
211 | "A list of options not loaded by `custom-load-symbol'. | |
212 | Set by `cus-test-noloads'.") | |
82e74860 | 213 | |
002cba79 MR |
214 | ;; (defvar cus-test-vars-cus-loaded nil |
215 | ;; "A list of options loaded by `custom-load-symbol'.") | |
bd08d86a | 216 | |
82e74860 MR |
217 | (defun cus-test-apropos (regexp) |
218 | "Check the options matching REGEXP. | |
219 | The detected problematic options are stored in `cus-test-errors'." | |
220 | (interactive "sVariable regexp: ") | |
221 | (setq cus-test-errors nil) | |
222 | (setq cus-test-tested-variables nil) | |
6be19e60 | 223 | (mapc |
82e74860 MR |
224 | (lambda (symbol) |
225 | (push symbol cus-test-tested-variables) | |
6be19e60 MR |
226 | ;; Be verbose in case we hang. |
227 | (message "Cus Test running...%s %s" | |
228 | (length cus-test-tested-variables) symbol) | |
82e74860 MR |
229 | (condition-case alpha |
230 | (let* ((type (custom-variable-type symbol)) | |
231 | (conv (widget-convert type)) | |
82e74860 MR |
232 | (get (or (get symbol 'custom-get) 'default-value)) |
233 | values | |
234 | mismatch) | |
235 | (when (default-boundp symbol) | |
592cd48b MR |
236 | (push (funcall get symbol) values) |
237 | (push (eval (car (get symbol 'standard-value))) values)) | |
82e74860 | 238 | (if (boundp symbol) |
592cd48b | 239 | (push (symbol-value symbol) values)) |
82e74860 | 240 | ;; That does not work. |
592cd48b | 241 | ;; (push (widget-get conv :value) values) |
82e74860 MR |
242 | |
243 | ;; Check the values | |
6be19e60 MR |
244 | (mapc (lambda (value) |
245 | (unless (widget-apply conv :match value) | |
246 | (setq mismatch 'mismatch))) | |
247 | values) | |
82e74860 | 248 | |
592cd48b MR |
249 | ;; Store symbols with a custom-get property. |
250 | (when (get symbol 'custom-get) | |
2a7e0e41 | 251 | (add-to-list 'cus-test-vars-with-custom-get symbol)) |
592cd48b | 252 | |
82e74860 | 253 | ;; Changed outside the customize buffer? |
bd08d86a MR |
254 | ;; This routine is not very much tested. |
255 | (let ((c-value | |
256 | (or (get symbol 'customized-value) | |
257 | (get symbol 'saved-value) | |
258 | (get symbol 'standard-value)))) | |
259 | (and (consp c-value) | |
260 | (boundp symbol) | |
261 | (not (equal (eval (car c-value)) (symbol-value symbol))) | |
2a7e0e41 | 262 | (add-to-list 'cus-test-vars-with-changed-state symbol))) |
82e74860 MR |
263 | |
264 | (if mismatch | |
592cd48b | 265 | (push symbol cus-test-errors))) |
82e74860 MR |
266 | |
267 | (error | |
592cd48b MR |
268 | (push symbol cus-test-errors) |
269 | (message "Error for %s: %s" symbol alpha)))) | |
82e74860 | 270 | (cus-test-get-options regexp)) |
6be19e60 | 271 | (message "%s options tested" |
82e74860 | 272 | (length cus-test-tested-variables)) |
592cd48b | 273 | (cus-test-errors-display)) |
82e74860 MR |
274 | |
275 | (defun cus-test-get-options (regexp) | |
276 | "Return a list of custom options matching REGEXP." | |
277 | (let (found) | |
278 | (mapatoms | |
279 | (lambda (symbol) | |
280 | (and | |
281 | (or | |
282 | ;; (user-variable-p symbol) | |
283 | (get symbol 'standard-value) | |
284 | ;; (get symbol 'saved-value) | |
285 | (get symbol 'custom-type)) | |
286 | (string-match regexp (symbol-name symbol)) | |
6be19e60 | 287 | (not (member symbol cus-test-skip-list)) |
82e74860 MR |
288 | (push symbol found)))) |
289 | found)) | |
290 | ||
291 | (defun cus-test-errors-display () | |
292 | "Report about the errors found by cus-test." | |
293 | (with-output-to-temp-buffer "*cus-test-errors*" | |
294 | (set-buffer standard-output) | |
295 | (insert (format "Cus Test tested %s variables.\ | |
296 | See `cus-test-tested-variables'.\n\n" | |
297 | (length cus-test-tested-variables))) | |
6be19e60 MR |
298 | (if (not cus-test-errors) |
299 | (insert "No errors found by cus-test.") | |
300 | (insert "The following variables seem to have problems:\n\n") | |
002cba79 MR |
301 | (dolist (e cus-test-errors) |
302 | (insert (symbol-name e) "\n"))))) | |
6be19e60 MR |
303 | |
304 | (defun cus-test-load-custom-loads () | |
82e74860 MR |
305 | "Call `custom-load-symbol' on all atoms." |
306 | (interactive) | |
307 | (mapatoms 'custom-load-symbol) | |
bd08d86a | 308 | (run-hooks 'cus-test-after-load-libs-hook)) |
82e74860 | 309 | |
6be19e60 MR |
310 | (defun cus-test-load-libs () |
311 | "Load the libraries with autoloads. | |
002cba79 | 312 | Don't load libraries in `cus-test-libs-noloads'." |
6be19e60 MR |
313 | (interactive) |
314 | (setq cus-test-libs-errors nil) | |
315 | (setq cus-test-libs-loaded nil) | |
316 | (mapc | |
317 | (lambda (file) | |
318 | (condition-case alpha | |
002cba79 | 319 | (unless (member file cus-test-libs-noloads) |
6be19e60 MR |
320 | (load file) |
321 | (push file cus-test-libs-loaded)) | |
322 | (error | |
323 | (push (cons file alpha) cus-test-libs-errors) | |
324 | (message "Error for %s: %s" file alpha)))) | |
325 | (cus-test-get-autoload-deps)) | |
326 | (message "%s libraries loaded successfully" | |
327 | (length cus-test-libs-loaded)) | |
328 | (if (not cus-test-libs-errors) | |
329 | (message "No load problems encountered") | |
330 | (message "The following load problems appeared:") | |
331 | (cus-test-message cus-test-libs-errors)) | |
332 | (run-hooks 'cus-test-after-load-libs-hook)) | |
333 | ||
334 | (defun cus-test-get-autoload-deps () | |
335 | "Return the list of libraries with autoloads." | |
336 | (with-temp-buffer | |
337 | (insert-file-contents (locate-library "loaddefs")) | |
338 | ;; This is from `customize-option'. | |
339 | (let (deps file) | |
340 | (while | |
341 | (search-forward "\n;;; Generated autoloads from " nil t) | |
342 | (goto-char (match-end 0)) | |
343 | (setq file (buffer-substring (point) | |
344 | (progn (end-of-line) (point)))) | |
345 | (setq file (file-name-nondirectory file)) | |
346 | (string-match "\\.el\\'" file) | |
347 | (setq file (substring file 0 (match-beginning 0))) | |
348 | (setq deps (nconc deps (list file)))) | |
349 | deps))) | |
350 | ||
351 | (defun cus-test-message (list) | |
352 | "Print the members of LIST line by line." | |
353 | (dolist (m list) (message "%s" m))) | |
354 | ||
355 | \f | |
592cd48b MR |
356 | ;;; The routines for batch mode: |
357 | ||
6be19e60 | 358 | (defun cus-test-opts () |
592cd48b MR |
359 | "Test custom options. |
360 | This function is suitable for batch mode. E.g., invoke | |
361 | ||
362 | src/emacs -batch -l admin/cus-test.el -f cus-test-opts | |
363 | ||
002cba79 | 364 | in the Emacs source directory." |
592cd48b | 365 | (interactive) |
bf7a63e1 MR |
366 | (message "Running %s" 'cus-test-load-libs) |
367 | (cus-test-load-libs) | |
592cd48b MR |
368 | (message "Running %s" 'cus-test-load-custom-loads) |
369 | (cus-test-load-custom-loads) | |
370 | (message "Running %s" 'cus-test-apropos) | |
371 | (cus-test-apropos "") | |
6be19e60 MR |
372 | (if (not cus-test-errors) |
373 | (message "No problems found") | |
374 | (message "The following options might have problems:") | |
375 | (cus-test-message cus-test-errors))) | |
592cd48b | 376 | |
6be19e60 | 377 | (defun cus-test-deps () |
592cd48b MR |
378 | "Run a verbose version of `custom-load-symbol' on all atoms. |
379 | This function is suitable for batch mode. E.g., invoke | |
380 | ||
381 | src/emacs -batch -l admin/cus-test.el -f cus-test-deps | |
382 | ||
002cba79 | 383 | in the Emacs source directory." |
592cd48b MR |
384 | (interactive) |
385 | (setq cus-test-deps-errors nil) | |
6be19e60 | 386 | (setq cus-test-deps-required nil) |
bd9aba20 | 387 | (setq cus-test-deps-loaded nil) |
592cd48b MR |
388 | (mapatoms |
389 | ;; This code is mainly from `custom-load-symbol'. | |
390 | (lambda (symbol) | |
002cba79 MR |
391 | (let ((custom-load-recursion t)) |
392 | (dolist (load (get symbol 'custom-loads)) | |
393 | (cond | |
394 | ((symbolp load) | |
395 | ;; (condition-case nil (require load) (error nil)) | |
396 | (condition-case alpha | |
397 | (unless (featurep load) | |
398 | (require load) | |
399 | (push (list symbol load) cus-test-deps-required)) | |
400 | (error | |
401 | (push (list symbol load alpha) cus-test-deps-errors) | |
402 | (message "Require problem: %s %s %s" symbol load alpha)))) | |
403 | ((equal load "loaddefs") | |
404 | (push | |
405 | (message "Symbol %s has loaddefs as custom dependency" symbol) | |
406 | cus-test-deps-errors)) | |
407 | ;; This is subsumed by the test below, but it's much | |
408 | ;; faster. | |
409 | ((assoc load load-history)) | |
410 | ;; This was just | |
411 | ;; (assoc (locate-library load) load-history) | |
412 | ;; but has been optimized not to load locate-library | |
413 | ;; if not necessary. | |
414 | ((let ((regexp (concat "\\(\\`\\|/\\)" (regexp-quote load) | |
415 | "\\(\\'\\|\\.\\)")) | |
416 | (found nil)) | |
417 | (dolist (loaded load-history) | |
418 | (and (stringp (car loaded)) | |
419 | (string-match regexp (car loaded)) | |
420 | (setq found t))) | |
421 | found)) | |
422 | ;; Without this, we would load cus-edit recursively. | |
423 | ;; We are still loading it when we call this, | |
424 | ;; and it is not in load-history yet. | |
425 | ((equal load "cus-edit")) | |
426 | ;; This would ignore load problems with files in | |
427 | ;; lisp/term/ | |
428 | ;; ((locate-library (concat term-file-prefix load))) | |
429 | (t | |
430 | ;; (condition-case nil (load load) (error nil)) | |
431 | (condition-case alpha | |
432 | (progn | |
433 | (load load) | |
434 | (push (list symbol load) cus-test-deps-loaded)) | |
435 | (error | |
436 | (push (list symbol load alpha) cus-test-deps-errors) | |
437 | (message "Load Problem: %s %s %s" symbol load alpha)))) | |
438 | ))))) | |
6be19e60 MR |
439 | (message "%s features required" |
440 | (length cus-test-deps-required)) | |
441 | (message "%s files loaded" | |
bd9aba20 | 442 | (length cus-test-deps-loaded)) |
6be19e60 MR |
443 | (if (not cus-test-deps-errors) |
444 | (message "No load problems encountered") | |
445 | (message "The following load problems appeared:") | |
446 | (cus-test-message cus-test-deps-errors)) | |
592cd48b MR |
447 | (run-hooks 'cus-test-after-load-libs-hook)) |
448 | ||
449 | (defun cus-test-libs () | |
6be19e60 | 450 | "Load the libraries with autoloads in separate processes. |
592cd48b MR |
451 | This function is useful to detect load problems of libraries. |
452 | It is suitable for batch mode. E.g., invoke | |
453 | ||
454 | src/emacs -batch -l admin/cus-test.el -f cus-test-libs | |
455 | ||
002cba79 | 456 | in the Emacs source directory." |
82e74860 | 457 | (interactive) |
6be19e60 MR |
458 | (with-temp-buffer |
459 | (setq cus-test-libs-errors nil) | |
460 | (setq cus-test-libs-loaded nil) | |
461 | (cd source-directory) | |
462 | (if (not (file-executable-p "src/emacs")) | |
463 | (error "No Emacs executable in %ssrc" default-directory)) | |
464 | (mapc | |
465 | (lambda (file) | |
466 | (condition-case alpha | |
467 | (let (fn cmd status) | |
468 | (setq fn (locate-library file)) | |
469 | (if (not fn) | |
470 | (error "Library %s not found" file)) | |
471 | (setq cmd (concat "src/emacs -batch -l " fn)) | |
472 | (setq status (call-process shell-file-name nil nil nil | |
473 | shell-command-switch cmd)) | |
e170d16c | 474 | (if (equal status 0) |
6be19e60 MR |
475 | (message "%s" file) |
476 | (error "%s" status)) | |
477 | (push file cus-test-libs-loaded)) | |
478 | (error | |
479 | (push (cons file alpha) cus-test-libs-errors) | |
480 | (message "Error for %s: %s" file alpha)))) | |
481 | (cus-test-get-autoload-deps)) | |
482 | (message "Default Directory: %s" default-directory) | |
483 | (message "%s libraries had no load errors" | |
484 | (length cus-test-libs-loaded)) | |
485 | (if (not cus-test-libs-errors) | |
486 | (message "No load problems encountered") | |
487 | (message "The following load problems appeared:") | |
488 | (cus-test-message cus-test-libs-errors)) | |
489 | (run-hooks 'cus-test-after-load-libs-hook))) | |
82e74860 | 490 | |
002cba79 MR |
491 | (defun cus-test-noloads () |
492 | "Find custom options not loaded by `custom-load-symbol'. | |
493 | Calling this function after `cus-test-load-libs' is not meaningful. | |
494 | It is suitable for batch mode. E.g., invoke | |
495 | ||
496 | src/emacs -batch -l admin/cus-test.el -f cus-test-noloads | |
497 | ||
498 | in the Emacs source directory." | |
499 | (interactive) | |
500 | (let (cus-loaded) | |
501 | ||
502 | (message "Running %s" 'cus-test-load-custom-loads) | |
503 | (cus-test-load-custom-loads) | |
504 | (setq cus-loaded | |
505 | (cus-test-get-options "")) | |
506 | ||
507 | (message "Running %s" 'cus-test-load-libs) | |
508 | (cus-test-load-libs) | |
509 | (setq cus-test-vars-not-cus-loaded | |
510 | (cus-test-get-options "")) | |
511 | ||
512 | (dolist (o cus-loaded) | |
513 | (setq cus-test-vars-not-cus-loaded | |
514 | (delete o cus-test-vars-not-cus-loaded))) | |
515 | ||
516 | (if (not cus-test-vars-not-cus-loaded) | |
517 | (message "No options not loaded by custom-load-symbol found") | |
518 | (message "The following options were not loaded by custom-load-symbol:") | |
519 | (cus-test-message | |
520 | (sort cus-test-vars-not-cus-loaded 'string<))))) | |
521 | ||
522 | ;; And last but not least a quiz: | |
523 | ;; | |
524 | ;; Evaluation of the form (customize-option 'debug-on-error) yields a | |
525 | ;; *Customize* buffer with a mismatch mess. Why? | |
526 | ||
82e74860 MR |
527 | (provide 'cus-test) |
528 | ||
ab5796a9 | 529 | ;;; arch-tag: a4991a31-548d-48fb-8ba1-1ebbe68eb2e7 |
82e74860 | 530 | ;;; cus-test.el ends here |