diff options
| author | Glenn Morris | 2013-05-08 23:09:39 -0700 |
|---|---|---|
| committer | Glenn Morris | 2013-05-08 23:09:39 -0700 |
| commit | d631786abe3f736aac572bbb56436fd2b56a671c (patch) | |
| tree | e1af99160fea35355fc716400818b0817c4041f3 | |
| parent | 2dee4d5e14705773017e5dcde7f58601f7a54709 (diff) | |
| download | emacs-d631786abe3f736aac572bbb56436fd2b56a671c.tar.gz emacs-d631786abe3f736aac572bbb56436fd2b56a671c.zip | |
admin/cus-test,el misc updates
Mainly for some files listed in loaddefs.el now being in subdirs that
are not in load-path.
* admin/cus-test.el (cus-test-libs-noloads): Add dunnet in the defvar.
(dunnet): Don't always load it.
(viper-mode): Only set if interactive.
(cus-test-load-custom-loads): Load dunnet if necessary.
(cus-test-load-1): New macro, with common code from cus-test-load-libs
and cus-test-libs.
(cus-test-load-libs, cus-test-libs): Use cus-test-load-1 macro.
Update for cus-test-get-autoload-deps changed result.
(cus-test-get-autoload-deps): Simplify. Return file names as they
appear in loaddefs.el (directory parts are needed now that not all
lisp subdirs are in load-path).
(cus-test-deps): Explicitly skip dunnet.
| -rw-r--r-- | admin/ChangeLog | 12 | ||||
| -rw-r--r-- | admin/cus-test.el | 147 |
2 files changed, 85 insertions, 74 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog index 1de6c1e8578..830854c8e63 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog | |||
| @@ -1,6 +1,18 @@ | |||
| 1 | 2013-05-09 Glenn Morris <rgm@gnu.org> | 1 | 2013-05-09 Glenn Morris <rgm@gnu.org> |
| 2 | 2 | ||
| 3 | * cus-test.el: No need to provide bbdb, bbdb-com any more. | 3 | * cus-test.el: No need to provide bbdb, bbdb-com any more. |
| 4 | (cus-test-libs-noloads): Add dunnet in the defvar. | ||
| 5 | (dunnet): Don't always load it. | ||
| 6 | (viper-mode): Only set if interactive. | ||
| 7 | (cus-test-load-custom-loads): Load dunnet if necessary. | ||
| 8 | (cus-test-load-1): New macro, with common code from cus-test-load-libs | ||
| 9 | and cus-test-libs. | ||
| 10 | (cus-test-load-libs, cus-test-libs): Use cus-test-load-1 macro. | ||
| 11 | Update for cus-test-get-autoload-deps changed result. | ||
| 12 | (cus-test-get-autoload-deps): Simplify. Return file names as they | ||
| 13 | appear in loaddefs.el (directory parts are needed now that not all | ||
| 14 | lisp subdirs are in load-path). | ||
| 15 | (cus-test-deps): Explicitly skip dunnet. | ||
| 4 | 16 | ||
| 5 | 2013-05-07 Paul Eggert <eggert@cs.ucla.edu> | 17 | 2013-05-07 Paul Eggert <eggert@cs.ucla.edu> |
| 6 | 18 | ||
diff --git a/admin/cus-test.el b/admin/cus-test.el index ec7934ebd8b..bce5f5da3cf 100644 --- a/admin/cus-test.el +++ b/admin/cus-test.el | |||
| @@ -99,18 +99,17 @@ | |||
| 99 | (defvar cus-test-skip-list nil | 99 | (defvar cus-test-skip-list nil |
| 100 | "List of variables to disregard by `cus-test-apropos'.") | 100 | "List of variables to disregard by `cus-test-apropos'.") |
| 101 | 101 | ||
| 102 | (defvar cus-test-libs-noloads nil | 102 | ;; Loading dunnet in batch mode leads to a Dead end. |
| 103 | "List of libraries not to load by `cus-test-load-libs'.") | 103 | (defvar cus-test-libs-noloads '("play/dunnet.el") |
| 104 | "List of files not to load by `cus-test-load-libs'. | ||
| 105 | Names should be as they appear in loaddefs.el.") | ||
| 104 | 106 | ||
| 105 | ;; This avoids a hang of `cus-test-apropos' in 21.2. | 107 | ;; This avoids a hang of `cus-test-apropos' in 21.2. |
| 106 | ;; (add-to-list 'cus-test-skip-list 'sh-alias-alist) | 108 | ;; (add-to-list 'cus-test-skip-list 'sh-alias-alist) |
| 107 | 109 | ||
| 108 | ;; Loading dunnet in batch mode leads to a Dead end. | 110 | (or noninteractive |
| 109 | (let (noninteractive) (load "dunnet")) | 111 | ;; Never Viperize. |
| 110 | (add-to-list 'cus-test-libs-noloads "dunnet") | 112 | (setq viper-mode nil)) |
| 111 | |||
| 112 | ;; Never Viperize. | ||
| 113 | (setq viper-mode nil) | ||
| 114 | 113 | ||
| 115 | ;; Don't create a file `save-place-file'. | 114 | ;; Don't create a file `save-place-file'. |
| 116 | (eval-after-load "saveplace" | 115 | (eval-after-load "saveplace" |
| @@ -259,49 +258,49 @@ The detected problematic options are stored in `cus-test-errors'." | |||
| 259 | (defun cus-test-load-custom-loads () | 258 | (defun cus-test-load-custom-loads () |
| 260 | "Call `custom-load-symbol' on all atoms." | 259 | "Call `custom-load-symbol' on all atoms." |
| 261 | (interactive) | 260 | (interactive) |
| 261 | (if noninteractive (let (noninteractive) (require 'dunnet))) | ||
| 262 | (mapatoms 'custom-load-symbol) | 262 | (mapatoms 'custom-load-symbol) |
| 263 | (run-hooks 'cus-test-after-load-libs-hook)) | 263 | (run-hooks 'cus-test-after-load-libs-hook)) |
| 264 | 264 | ||
| 265 | (defmacro cus-test-load-1 (&rest body) | ||
| 266 | `(progn | ||
| 267 | (setq cus-test-libs-errors nil | ||
| 268 | cus-test-libs-loaded nil) | ||
| 269 | ,@body | ||
| 270 | (message "%s libraries loaded successfully" | ||
| 271 | (length cus-test-libs-loaded)) | ||
| 272 | (if (not cus-test-libs-errors) | ||
| 273 | (message "No load problems encountered") | ||
| 274 | (message "The following load problems appeared:") | ||
| 275 | (cus-test-message cus-test-libs-errors)) | ||
| 276 | (run-hooks 'cus-test-after-load-libs-hook))) | ||
| 277 | |||
| 278 | ;; This is just cus-test-libs, but loading in the current Emacs process. | ||
| 265 | (defun cus-test-load-libs () | 279 | (defun cus-test-load-libs () |
| 266 | "Load the libraries with autoloads. | 280 | "Load the libraries with autoloads. |
| 267 | Don't load libraries in `cus-test-libs-noloads'." | 281 | Don't load libraries in `cus-test-libs-noloads'." |
| 268 | (interactive) | 282 | (interactive) |
| 269 | (setq cus-test-libs-errors nil) | 283 | (cus-test-load-1 |
| 270 | (setq cus-test-libs-loaded nil) | 284 | (let ((lispdir (file-name-directory (locate-library "loaddefs")))) |
| 271 | (mapc | 285 | (mapc |
| 272 | (lambda (file) | 286 | (lambda (file) |
| 273 | (condition-case alpha | 287 | (condition-case alpha |
| 274 | (unless (member file cus-test-libs-noloads) | 288 | (unless (member file cus-test-libs-noloads) |
| 275 | (load file) | 289 | (load (file-name-sans-extension (expand-file-name file lispdir))) |
| 276 | (push file cus-test-libs-loaded)) | 290 | (push file cus-test-libs-loaded)) |
| 277 | (error | 291 | (error |
| 278 | (push (cons file alpha) cus-test-libs-errors) | 292 | (push (cons file alpha) cus-test-libs-errors) |
| 279 | (message "Error for %s: %s" file alpha)))) | 293 | (message "Error for %s: %s" file alpha)))) |
| 280 | (cus-test-get-autoload-deps)) | 294 | (cus-test-get-autoload-deps))))) |
| 281 | (message "%s libraries loaded successfully" | ||
| 282 | (length cus-test-libs-loaded)) | ||
| 283 | (if (not cus-test-libs-errors) | ||
| 284 | (message "No load problems encountered") | ||
| 285 | (message "The following load problems appeared:") | ||
| 286 | (cus-test-message cus-test-libs-errors)) | ||
| 287 | (run-hooks 'cus-test-after-load-libs-hook)) | ||
| 288 | 295 | ||
| 289 | (defun cus-test-get-autoload-deps () | 296 | (defun cus-test-get-autoload-deps () |
| 290 | "Return the list of libraries with autoloads." | 297 | "Return the list of files with autoloads." |
| 291 | (with-temp-buffer | 298 | (with-temp-buffer |
| 292 | (insert-file-contents (locate-library "loaddefs")) | 299 | (insert-file-contents (locate-library "loaddefs")) |
| 293 | ;; This is from `customize-option'. | 300 | (let (files) |
| 294 | (let (deps file) | 301 | (while (search-forward "\n;;; Generated autoloads from " nil t) |
| 295 | (while | 302 | (push (buffer-substring (match-end 0) (line-end-position)) files)) |
| 296 | (search-forward "\n;;; Generated autoloads from " nil t) | 303 | files))) |
| 297 | (goto-char (match-end 0)) | ||
| 298 | (setq file (buffer-substring (point) | ||
| 299 | (progn (end-of-line) (point)))) | ||
| 300 | (setq file (file-name-nondirectory file)) | ||
| 301 | (string-match "\\.el\\'" file) | ||
| 302 | (setq file (substring file 0 (match-beginning 0))) | ||
| 303 | (setq deps (nconc deps (list file)))) | ||
| 304 | deps))) | ||
| 305 | 304 | ||
| 306 | (defun cus-test-message (list) | 305 | (defun cus-test-message (list) |
| 307 | "Print the members of LIST line by line." | 306 | "Print the members of LIST line by line." |
| @@ -349,7 +348,8 @@ in the Emacs source directory." | |||
| 349 | ((symbolp load) | 348 | ((symbolp load) |
| 350 | ;; (condition-case nil (require load) (error nil)) | 349 | ;; (condition-case nil (require load) (error nil)) |
| 351 | (condition-case alpha | 350 | (condition-case alpha |
| 352 | (unless (featurep load) | 351 | (unless (or (featurep load) |
| 352 | (and noninteractive (eq load 'dunnet))) | ||
| 353 | (require load) | 353 | (require load) |
| 354 | (push (list symbol load) cus-test-deps-required)) | 354 | (push (list symbol load) cus-test-deps-required)) |
| 355 | (error | 355 | (error |
| @@ -406,42 +406,41 @@ in the Emacs source directory." | |||
| 406 | This function is useful to detect load problems of libraries. | 406 | This function is useful to detect load problems of libraries. |
| 407 | It is suitable for batch mode. E.g., invoke | 407 | It is suitable for batch mode. E.g., invoke |
| 408 | 408 | ||
| 409 | src/emacs -batch -l admin/cus-test.el -f cus-test-libs | 409 | ./src/emacs -batch -l admin/cus-test.el -f cus-test-libs |
| 410 | 410 | ||
| 411 | in the Emacs source directory." | 411 | in the Emacs source directory." |
| 412 | (interactive) | 412 | (interactive) |
| 413 | (with-temp-buffer | 413 | (cus-test-load-1 |
| 414 | (setq cus-test-libs-errors nil) | 414 | (let ((default-directory source-directory) |
| 415 | (setq cus-test-libs-loaded nil) | 415 | (emacs (expand-file-name "src/emacs")) |
| 416 | (cd source-directory) | 416 | skipped) |
| 417 | (if (not (file-executable-p "src/emacs")) | 417 | (or (file-executable-p emacs) |
| 418 | (error "No Emacs executable in %ssrc" default-directory)) | 418 | (error "No Emacs executable in %ssrc" default-directory)) |
| 419 | (mapc | 419 | (mapc |
| 420 | (lambda (file) | 420 | (lambda (file) |
| 421 | (condition-case alpha | 421 | (if (member file cus-test-libs-noloads) |
| 422 | (let (fn cmd status) | 422 | (push file skipped) |
| 423 | (setq fn (locate-library file)) | 423 | (condition-case alpha |
| 424 | (if (not fn) | 424 | (let* ((fn (expand-file-name file "lisp/")) |
| 425 | (error "Library %s not found" file)) | 425 | (elc (concat fn "c")) |
| 426 | (setq cmd (concat "src/emacs -batch -l " fn)) | 426 | status) |
| 427 | (setq status (call-process shell-file-name nil nil nil | 427 | (if (file-readable-p elc) ; load compiled if present (faster) |
| 428 | shell-command-switch cmd)) | 428 | (setq fn elc) |
| 429 | (if (equal status 0) | 429 | (or (file-readable-p fn) |
| 430 | (message "%s" file) | 430 | (error "Library %s not found" file))) |
| 431 | (error "%s" status)) | 431 | (if (equal 0 (setq status (call-process emacs nil nil nil |
| 432 | (push file cus-test-libs-loaded)) | 432 | "-batch" "-l" fn))) |
| 433 | (error | 433 | (message "%s" file) |
| 434 | (push (cons file alpha) cus-test-libs-errors) | 434 | (error "%s" status)) |
| 435 | (message "Error for %s: %s" file alpha)))) | 435 | (push file cus-test-libs-loaded)) |
| 436 | (cus-test-get-autoload-deps)) | 436 | (error |
| 437 | (message "Default Directory: %s" default-directory) | 437 | (push (cons file alpha) cus-test-libs-errors) |
| 438 | (message "%s libraries had no load errors" | 438 | (message "Error for %s: %s" file alpha))))) |
| 439 | (length cus-test-libs-loaded)) | 439 | (cus-test-get-autoload-deps)) |
| 440 | (if (not cus-test-libs-errors) | 440 | (message "Default directory: %s" default-directory) |
| 441 | (message "No load problems encountered") | 441 | (when skipped |
| 442 | (message "The following load problems appeared:") | 442 | (message "The following libraries were skipped:") |
| 443 | (cus-test-message cus-test-libs-errors)) | 443 | (cus-test-message skipped))))) |
| 444 | (run-hooks 'cus-test-after-load-libs-hook))) | ||
| 445 | 444 | ||
| 446 | (defun cus-test-noloads () | 445 | (defun cus-test-noloads () |
| 447 | "Find custom options not loaded by `custom-load-symbol'. | 446 | "Find custom options not loaded by `custom-load-symbol'. |