diff options
| author | Markus Rost | 2002-10-16 04:41:59 +0000 |
|---|---|---|
| committer | Markus Rost | 2002-10-16 04:41:59 +0000 |
| commit | 002cba7933bd5b107391c8c411c0ca6bd86c84f1 (patch) | |
| tree | 3142c1eb702b95204124ee2d8d7a214504842bad /admin | |
| parent | 92b304ac5bad9bba31947b144c4f933bf979a919 (diff) | |
| download | emacs-002cba7933bd5b107391c8c411c0ca6bd86c84f1.tar.gz emacs-002cba7933bd5b107391c8c411c0ca6bd86c84f1.zip | |
Reworked. Added a new test cus-test-noloads. And a quiz.
Diffstat (limited to 'admin')
| -rw-r--r-- | admin/cus-test.el | 188 |
1 files changed, 124 insertions, 64 deletions
diff --git a/admin/cus-test.el b/admin/cus-test.el index 8885b097873..bebf89cdeb5 100644 --- a/admin/cus-test.el +++ b/admin/cus-test.el | |||
| @@ -38,6 +38,8 @@ | |||
| 38 | ;; | 38 | ;; |
| 39 | ;; src/emacs -batch -l admin/cus-test.el -f cus-test-libs | 39 | ;; src/emacs -batch -l admin/cus-test.el -f cus-test-libs |
| 40 | ;; | 40 | ;; |
| 41 | ;; src/emacs -batch -l admin/cus-test.el -f cus-test-noloads | ||
| 42 | ;; | ||
| 41 | ;; in the emacs source directory. | 43 | ;; in the emacs source directory. |
| 42 | ;; | 44 | ;; |
| 43 | ;; For interactive use: Load this file. Then | 45 | ;; For interactive use: Load this file. Then |
| @@ -84,6 +86,10 @@ | |||
| 84 | ;; The command `cus-test-libs' runs for all libraries with autoloads | 86 | ;; The command `cus-test-libs' runs for all libraries with autoloads |
| 85 | ;; separate emacs processes of the form "emacs -batch -l LIB". | 87 | ;; separate emacs processes of the form "emacs -batch -l LIB". |
| 86 | ;; | 88 | ;; |
| 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 | ;; | ||
| 87 | ;; Some results from October 2002: | 93 | ;; Some results from October 2002: |
| 88 | ;; | 94 | ;; |
| 89 | ;; 4523 options tested | 95 | ;; 4523 options tested |
| @@ -108,6 +114,18 @@ | |||
| 108 | ;; (eudc-export error 255) | 114 | ;; (eudc-export error 255) |
| 109 | ;; (ada-xref error 255) | 115 | ;; (ada-xref error 255) |
| 110 | ;; (ada-stmt error 255) | 116 | ;; (ada-stmt error 255) |
| 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 | ||
| 111 | 129 | ||
| 112 | 130 | ||
| 113 | ;;; Code: | 131 | ;;; Code: |
| @@ -120,7 +138,7 @@ | |||
| 120 | (defvar cus-test-skip-list nil | 138 | (defvar cus-test-skip-list nil |
| 121 | "List of variables to disregard by `cus-test-apropos'.") | 139 | "List of variables to disregard by `cus-test-apropos'.") |
| 122 | 140 | ||
| 123 | (defvar cus-test-noloads nil | 141 | (defvar cus-test-libs-noloads nil |
| 124 | "List of libraries not to load by `cus-test-load-libs'.") | 142 | "List of libraries not to load by `cus-test-load-libs'.") |
| 125 | 143 | ||
| 126 | ;; The file eudc-export.el loads libraries "bbdb" and "bbdb-com" which | 144 | ;; The file eudc-export.el loads libraries "bbdb" and "bbdb-com" which |
| @@ -146,7 +164,7 @@ | |||
| 146 | 164 | ||
| 147 | ;; Loading dunnet in batch mode leads to a Dead end. | 165 | ;; Loading dunnet in batch mode leads to a Dead end. |
| 148 | (let (noninteractive) (load "dunnet")) | 166 | (let (noninteractive) (load "dunnet")) |
| 149 | (add-to-list 'cus-test-noloads "dunnet") | 167 | (add-to-list 'cus-test-libs-noloads "dunnet") |
| 150 | 168 | ||
| 151 | ;; Never Viperize. | 169 | ;; Never Viperize. |
| 152 | (setq viper-mode nil) | 170 | (setq viper-mode nil) |
| @@ -177,6 +195,14 @@ | |||
| 177 | (defvar cus-test-tested-variables nil | 195 | (defvar cus-test-tested-variables nil |
| 178 | "List of options tested by last call of `cus-test-apropos'.") | 196 | "List of options tested by last call of `cus-test-apropos'.") |
| 179 | 197 | ||
| 198 | ;; I haven't understood this :get stuff. The symbols with a | ||
| 199 | ;; custom-get property are stored here. | ||
| 200 | (defvar cus-test-vars-with-custom-get nil | ||
| 201 | "Set by `cus-test-apropos' to a list of options with :get property.") | ||
| 202 | |||
| 203 | (defvar cus-test-vars-with-changed-state nil | ||
| 204 | "Set by `cus-test-apropos' to a list of options with state 'changed.") | ||
| 205 | |||
| 180 | (defvar cus-test-deps-errors nil | 206 | (defvar cus-test-deps-errors nil |
| 181 | "List of require/load problems found by `cus-test-deps'.") | 207 | "List of require/load problems found by `cus-test-deps'.") |
| 182 | 208 | ||
| @@ -193,13 +219,12 @@ Only unloaded features will be require'd.") | |||
| 193 | (defvar cus-test-libs-loaded nil | 219 | (defvar cus-test-libs-loaded nil |
| 194 | "List of files loaded by `cus-test-load-libs' or `cus-test-libs'.") | 220 | "List of files loaded by `cus-test-load-libs' or `cus-test-libs'.") |
| 195 | 221 | ||
| 196 | ;; I haven't understood this :get stuff. The symbols with a | 222 | (defvar cus-test-vars-not-cus-loaded nil |
| 197 | ;; custom-get property are stored here. | 223 | "A list of options not loaded by `custom-load-symbol'. |
| 198 | (defvar cus-test-vars-with-custom-get nil | 224 | Set by `cus-test-noloads'.") |
| 199 | "Set by `cus-test-apropos' to a list of options with :get property.") | ||
| 200 | 225 | ||
| 201 | (defvar cus-test-vars-with-changed-state nil | 226 | ;; (defvar cus-test-vars-cus-loaded nil |
| 202 | "Set by `cus-test-apropos' to a list of options with state 'changed.") | 227 | ;; "A list of options loaded by `custom-load-symbol'.") |
| 203 | 228 | ||
| 204 | (defun cus-test-apropos (regexp) | 229 | (defun cus-test-apropos (regexp) |
| 205 | "Check the options matching REGEXP. | 230 | "Check the options matching REGEXP. |
| @@ -285,8 +310,8 @@ The detected problematic options are stored in `cus-test-errors'." | |||
| 285 | (if (not cus-test-errors) | 310 | (if (not cus-test-errors) |
| 286 | (insert "No errors found by cus-test.") | 311 | (insert "No errors found by cus-test.") |
| 287 | (insert "The following variables seem to have problems:\n\n") | 312 | (insert "The following variables seem to have problems:\n\n") |
| 288 | (dolist (E cus-test-errors) | 313 | (dolist (e cus-test-errors) |
| 289 | (insert (symbol-name E) "\n"))))) | 314 | (insert (symbol-name e) "\n"))))) |
| 290 | 315 | ||
| 291 | (defun cus-test-load-custom-loads () | 316 | (defun cus-test-load-custom-loads () |
| 292 | "Call `custom-load-symbol' on all atoms." | 317 | "Call `custom-load-symbol' on all atoms." |
| @@ -296,14 +321,14 @@ The detected problematic options are stored in `cus-test-errors'." | |||
| 296 | 321 | ||
| 297 | (defun cus-test-load-libs () | 322 | (defun cus-test-load-libs () |
| 298 | "Load the libraries with autoloads. | 323 | "Load the libraries with autoloads. |
| 299 | Don't load libraries in `cus-test-noloads'." | 324 | Don't load libraries in `cus-test-libs-noloads'." |
| 300 | (interactive) | 325 | (interactive) |
| 301 | (setq cus-test-libs-errors nil) | 326 | (setq cus-test-libs-errors nil) |
| 302 | (setq cus-test-libs-loaded nil) | 327 | (setq cus-test-libs-loaded nil) |
| 303 | (mapc | 328 | (mapc |
| 304 | (lambda (file) | 329 | (lambda (file) |
| 305 | (condition-case alpha | 330 | (condition-case alpha |
| 306 | (unless (member file cus-test-noloads) | 331 | (unless (member file cus-test-libs-noloads) |
| 307 | (load file) | 332 | (load file) |
| 308 | (push file cus-test-libs-loaded)) | 333 | (push file cus-test-libs-loaded)) |
| 309 | (error | 334 | (error |
| @@ -348,7 +373,7 @@ This function is suitable for batch mode. E.g., invoke | |||
| 348 | 373 | ||
| 349 | src/emacs -batch -l admin/cus-test.el -f cus-test-opts | 374 | src/emacs -batch -l admin/cus-test.el -f cus-test-opts |
| 350 | 375 | ||
| 351 | in the emacs source directory." | 376 | in the Emacs source directory." |
| 352 | (interactive) | 377 | (interactive) |
| 353 | (message "Running %s" 'cus-test-load-libs) | 378 | (message "Running %s" 'cus-test-load-libs) |
| 354 | (cus-test-load-libs) | 379 | (cus-test-load-libs) |
| @@ -367,7 +392,7 @@ This function is suitable for batch mode. E.g., invoke | |||
| 367 | 392 | ||
| 368 | src/emacs -batch -l admin/cus-test.el -f cus-test-deps | 393 | src/emacs -batch -l admin/cus-test.el -f cus-test-deps |
| 369 | 394 | ||
| 370 | in the emacs source directory." | 395 | in the Emacs source directory." |
| 371 | (interactive) | 396 | (interactive) |
| 372 | (setq cus-test-deps-errors nil) | 397 | (setq cus-test-deps-errors nil) |
| 373 | (setq cus-test-deps-required nil) | 398 | (setq cus-test-deps-required nil) |
| @@ -375,55 +400,54 @@ in the emacs source directory." | |||
| 375 | (mapatoms | 400 | (mapatoms |
| 376 | ;; This code is mainly from `custom-load-symbol'. | 401 | ;; This code is mainly from `custom-load-symbol'. |
| 377 | (lambda (symbol) | 402 | (lambda (symbol) |
| 378 | (unless custom-load-recursion | 403 | (let ((custom-load-recursion t)) |
| 379 | (let ((custom-load-recursion t)) | 404 | (dolist (load (get symbol 'custom-loads)) |
| 380 | (dolist (load (get symbol 'custom-loads)) | 405 | (cond |
| 381 | (cond | 406 | ((symbolp load) |
| 382 | ((symbolp load) | 407 | ;; (condition-case nil (require load) (error nil)) |
| 383 | ;; (condition-case nil (require load) (error nil)) | 408 | (condition-case alpha |
| 384 | (condition-case alpha | 409 | (unless (featurep load) |
| 385 | (unless (featurep load) | 410 | (require load) |
| 386 | (require load) | 411 | (push (list symbol load) cus-test-deps-required)) |
| 387 | (push (list symbol load) cus-test-deps-required)) | 412 | (error |
| 388 | (error | 413 | (push (list symbol load alpha) cus-test-deps-errors) |
| 389 | (push (list symbol load alpha) cus-test-deps-errors) | 414 | (message "Require problem: %s %s %s" symbol load alpha)))) |
| 390 | (message "Require problem: %s %s %s" symbol load alpha)))) | 415 | ((equal load "loaddefs") |
| 391 | ((equal load "loaddefs") | 416 | (push |
| 392 | (push | 417 | (message "Symbol %s has loaddefs as custom dependency" symbol) |
| 393 | (message "Symbol %s has loaddefs as custom dependency" symbol) | 418 | cus-test-deps-errors)) |
| 394 | cus-test-deps-errors)) | 419 | ;; This is subsumed by the test below, but it's much |
| 395 | ;; This is subsumed by the test below, but it's much | 420 | ;; faster. |
| 396 | ;; faster. | 421 | ((assoc load load-history)) |
| 397 | ((assoc load load-history)) | 422 | ;; This was just |
| 398 | ;; This was just | 423 | ;; (assoc (locate-library load) load-history) |
| 399 | ;; (assoc (locate-library load) load-history) | 424 | ;; but has been optimized not to load locate-library |
| 400 | ;; but has been optimized not to load locate-library | 425 | ;; if not necessary. |
| 401 | ;; if not necessary. | 426 | ((let ((regexp (concat "\\(\\`\\|/\\)" (regexp-quote load) |
| 402 | ((let ((regexp (concat "\\(\\`\\|/\\)" (regexp-quote load) | 427 | "\\(\\'\\|\\.\\)")) |
| 403 | "\\(\\'\\|\\.\\)")) | 428 | (found nil)) |
| 404 | (found nil)) | 429 | (dolist (loaded load-history) |
| 405 | (dolist (loaded load-history) | 430 | (and (stringp (car loaded)) |
| 406 | (and (stringp (car loaded)) | 431 | (string-match regexp (car loaded)) |
| 407 | (string-match regexp (car loaded)) | 432 | (setq found t))) |
| 408 | (setq found t))) | 433 | found)) |
| 409 | found)) | 434 | ;; Without this, we would load cus-edit recursively. |
| 410 | ;; Without this, we would load cus-edit recursively. | 435 | ;; We are still loading it when we call this, |
| 411 | ;; We are still loading it when we call this, | 436 | ;; and it is not in load-history yet. |
| 412 | ;; and it is not in load-history yet. | 437 | ((equal load "cus-edit")) |
| 413 | ((equal load "cus-edit")) | 438 | ;; This would ignore load problems with files in |
| 414 | ;; This would ignore load problems with files in | 439 | ;; lisp/term/ |
| 415 | ;; lisp/term/ | 440 | ;; ((locate-library (concat term-file-prefix load))) |
| 416 | ;; ((locate-library (concat term-file-prefix load))) | 441 | (t |
| 417 | (t | 442 | ;; (condition-case nil (load load) (error nil)) |
| 418 | ;; (condition-case nil (load load) (error nil)) | 443 | (condition-case alpha |
| 419 | (condition-case alpha | 444 | (progn |
| 420 | (progn | 445 | (load load) |
| 421 | (load load) | 446 | (push (list symbol load) cus-test-deps-loaded)) |
| 422 | (push (list symbol load) cus-test-deps-loaded)) | 447 | (error |
| 423 | (error | 448 | (push (list symbol load alpha) cus-test-deps-errors) |
| 424 | (push (list symbol load alpha) cus-test-deps-errors) | 449 | (message "Load Problem: %s %s %s" symbol load alpha)))) |
| 425 | (message "Load Problem: %s %s %s" symbol load alpha)))) | 450 | ))))) |
| 426 | )))))) | ||
| 427 | (message "%s features required" | 451 | (message "%s features required" |
| 428 | (length cus-test-deps-required)) | 452 | (length cus-test-deps-required)) |
| 429 | (message "%s files loaded" | 453 | (message "%s files loaded" |
| @@ -441,7 +465,7 @@ It is suitable for batch mode. E.g., invoke | |||
| 441 | 465 | ||
| 442 | src/emacs -batch -l admin/cus-test.el -f cus-test-libs | 466 | src/emacs -batch -l admin/cus-test.el -f cus-test-libs |
| 443 | 467 | ||
| 444 | in the emacs source directory." | 468 | in the Emacs source directory." |
| 445 | (interactive) | 469 | (interactive) |
| 446 | (with-temp-buffer | 470 | (with-temp-buffer |
| 447 | (setq cus-test-libs-errors nil) | 471 | (setq cus-test-libs-errors nil) |
| @@ -476,6 +500,42 @@ in the emacs source directory." | |||
| 476 | (cus-test-message cus-test-libs-errors)) | 500 | (cus-test-message cus-test-libs-errors)) |
| 477 | (run-hooks 'cus-test-after-load-libs-hook))) | 501 | (run-hooks 'cus-test-after-load-libs-hook))) |
| 478 | 502 | ||
| 503 | (defun cus-test-noloads () | ||
| 504 | "Find custom options not loaded by `custom-load-symbol'. | ||
| 505 | Calling this function after `cus-test-load-libs' is not meaningful. | ||
| 506 | It is suitable for batch mode. E.g., invoke | ||
| 507 | |||
| 508 | src/emacs -batch -l admin/cus-test.el -f cus-test-noloads | ||
| 509 | |||
| 510 | in the Emacs source directory." | ||
| 511 | (interactive) | ||
| 512 | (let (cus-loaded) | ||
| 513 | |||
| 514 | (message "Running %s" 'cus-test-load-custom-loads) | ||
| 515 | (cus-test-load-custom-loads) | ||
| 516 | (setq cus-loaded | ||
| 517 | (cus-test-get-options "")) | ||
| 518 | |||
| 519 | (message "Running %s" 'cus-test-load-libs) | ||
| 520 | (cus-test-load-libs) | ||
| 521 | (setq cus-test-vars-not-cus-loaded | ||
| 522 | (cus-test-get-options "")) | ||
| 523 | |||
| 524 | (dolist (o cus-loaded) | ||
| 525 | (setq cus-test-vars-not-cus-loaded | ||
| 526 | (delete o cus-test-vars-not-cus-loaded))) | ||
| 527 | |||
| 528 | (if (not cus-test-vars-not-cus-loaded) | ||
| 529 | (message "No options not loaded by custom-load-symbol found") | ||
| 530 | (message "The following options were not loaded by custom-load-symbol:") | ||
| 531 | (cus-test-message | ||
| 532 | (sort cus-test-vars-not-cus-loaded 'string<))))) | ||
| 533 | |||
| 534 | ;; And last but not least a quiz: | ||
| 535 | ;; | ||
| 536 | ;; Evaluation of the form (customize-option 'debug-on-error) yields a | ||
| 537 | ;; *Customize* buffer with a mismatch mess. Why? | ||
| 538 | |||
| 479 | (provide 'cus-test) | 539 | (provide 'cus-test) |
| 480 | 540 | ||
| 481 | ;;; cus-test.el ends here | 541 | ;;; cus-test.el ends here |