diff options
| author | Glenn Morris | 2013-05-15 20:20:34 -0400 |
|---|---|---|
| committer | Glenn Morris | 2013-05-15 20:20:34 -0400 |
| commit | 5ebfa896aeba805c8d6e8426b1230dccba856f28 (patch) | |
| tree | bb4660f70ed2cd22a33f0a5af5af1838b7afdf3b /admin | |
| parent | ed8be7ff74614e2514275f18e166905814963fdd (diff) | |
| download | emacs-5ebfa896aeba805c8d6e8426b1230dccba856f28.tar.gz emacs-5ebfa896aeba805c8d6e8426b1230dccba856f28.zip | |
Add some cus-test.el stuff for custom groups
* admin/cus-test.el (cus-test-cus-load-groups): New function.
(cus-test-get-options): Add option to return groups.
(cus-test-noloads): Also check custom groups.
Diffstat (limited to 'admin')
| -rw-r--r-- | admin/ChangeLog | 6 | ||||
| -rw-r--r-- | admin/cus-test.el | 57 |
2 files changed, 49 insertions, 14 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog index 01a6a3ae170..221d5c0586c 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-05-16 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * cus-test.el (cus-test-cus-load-groups): New function. | ||
| 4 | (cus-test-get-options): Add option to return groups. | ||
| 5 | (cus-test-noloads): Also check custom groups. | ||
| 6 | |||
| 1 | 2013-05-15 Stefan Monnier <monnier@iro.umontreal.ca> | 7 | 2013-05-15 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 8 | ||
| 3 | * quick-install-emacs: Don't prune DOC-* files a any more. | 9 | * quick-install-emacs: Don't prune DOC-* files a any more. |
diff --git a/admin/cus-test.el b/admin/cus-test.el index e68ee7744e7..6b8ec9abe02 100644 --- a/admin/cus-test.el +++ b/admin/cus-test.el | |||
| @@ -232,17 +232,38 @@ The detected problematic options are stored in `cus-test-errors'." | |||
| 232 | (length cus-test-tested-variables)) | 232 | (length cus-test-tested-variables)) |
| 233 | (cus-test-errors-display)) | 233 | (cus-test-errors-display)) |
| 234 | 234 | ||
| 235 | (defun cus-test-get-options (regexp) | 235 | (defun cus-test-cus-load-groups (&optional cus-load) |
| 236 | "Return a list of custom options matching REGEXP." | 236 | "Return a list of current custom groups. |
| 237 | (let (found) | 237 | If CUS-LOAD is non-nil, include groups from cus-load.el." |
| 238 | (append (mapcar 'cdr custom-current-group-alist) | ||
| 239 | (if cus-load | ||
| 240 | (with-temp-buffer | ||
| 241 | (insert-file-contents (locate-library "cus-load.el")) | ||
| 242 | (search-forward "(put '") | ||
| 243 | (beginning-of-line) | ||
| 244 | (let (res) | ||
| 245 | (while (and (looking-at "^(put '\\(\\S-+\\)") | ||
| 246 | (zerop (forward-line 1))) | ||
| 247 | (push (intern (match-string 1)) res)) | ||
| 248 | res))))) | ||
| 249 | |||
| 250 | (defun cus-test-get-options (regexp &optional group) | ||
| 251 | "Return a list of custom options matching REGEXP. | ||
| 252 | If GROUP is non-nil, return groups rather than options. | ||
| 253 | If GROUP is `cus-load', include groups listed in cus-loads as well as | ||
| 254 | currently defined groups." | ||
| 255 | (let ((groups (if group (cus-test-cus-load-groups (eq group 'cus-load)))) | ||
| 256 | found) | ||
| 238 | (mapatoms | 257 | (mapatoms |
| 239 | (lambda (symbol) | 258 | (lambda (symbol) |
| 240 | (and | 259 | (and |
| 241 | (or | 260 | (if group |
| 242 | ;; (user-variable-p symbol) | 261 | (memq symbol groups) |
| 243 | (get symbol 'standard-value) | 262 | (or |
| 244 | ;; (get symbol 'saved-value) | 263 | ;; (user-variable-p symbol) |
| 245 | (get symbol 'custom-type)) | 264 | (get symbol 'standard-value) |
| 265 | ;; (get symbol 'saved-value) | ||
| 266 | (get symbol 'custom-type))) | ||
| 246 | (string-match regexp (symbol-name symbol)) | 267 | (string-match regexp (symbol-name symbol)) |
| 247 | (not (member symbol cus-test-skip-list)) | 268 | (not (member symbol cus-test-skip-list)) |
| 248 | (push symbol found)))) | 269 | (push symbol found)))) |
| @@ -492,17 +513,17 @@ It is suitable for batch mode. E.g., invoke | |||
| 492 | 513 | ||
| 493 | in the Emacs source directory." | 514 | in the Emacs source directory." |
| 494 | (interactive) | 515 | (interactive) |
| 495 | (let (cus-loaded) | 516 | (let ((groups-loaded (cus-test-get-options "" 'cus-load)) |
| 517 | cus-loaded groups-not-loaded) | ||
| 496 | 518 | ||
| 497 | (message "Running %s" 'cus-test-load-custom-loads) | 519 | (message "Running %s" 'cus-test-load-custom-loads) |
| 498 | (cus-test-load-custom-loads) | 520 | (cus-test-load-custom-loads) |
| 499 | (setq cus-loaded | 521 | (setq cus-loaded (cus-test-get-options "")) |
| 500 | (cus-test-get-options "")) | ||
| 501 | 522 | ||
| 502 | (message "Running %s" 'cus-test-load-libs) | 523 | (message "Running %s" 'cus-test-load-libs) |
| 503 | (cus-test-load-libs "all") | 524 | (cus-test-load-libs "all") |
| 504 | (setq cus-test-vars-not-cus-loaded | 525 | (setq cus-test-vars-not-cus-loaded (cus-test-get-options "") |
| 505 | (cus-test-get-options "")) | 526 | groups-not-loaded (cus-test-get-options "" t)) |
| 506 | 527 | ||
| 507 | (dolist (o cus-loaded) | 528 | (dolist (o cus-loaded) |
| 508 | (setq cus-test-vars-not-cus-loaded | 529 | (setq cus-test-vars-not-cus-loaded |
| @@ -512,7 +533,15 @@ in the Emacs source directory." | |||
| 512 | (message "No options not loaded by custom-load-symbol found") | 533 | (message "No options not loaded by custom-load-symbol found") |
| 513 | (message "The following options were not loaded by custom-load-symbol:") | 534 | (message "The following options were not loaded by custom-load-symbol:") |
| 514 | (cus-test-message | 535 | (cus-test-message |
| 515 | (sort cus-test-vars-not-cus-loaded 'string<))))) | 536 | (sort cus-test-vars-not-cus-loaded 'string<))) |
| 537 | |||
| 538 | (dolist (o groups-loaded) | ||
| 539 | (setq groups-not-loaded (delete o groups-not-loaded))) | ||
| 540 | |||
| 541 | (if (not groups-not-loaded) | ||
| 542 | (message "No groups not in cus-load.el found") | ||
| 543 | (message "The following groups are not in cus-load.el:") | ||
| 544 | (cus-test-message (sort groups-not-loaded 'string<))))) | ||
| 516 | 545 | ||
| 517 | (provide 'cus-test) | 546 | (provide 'cus-test) |
| 518 | 547 | ||