1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-10 00:00:39 -08:00

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.
This commit is contained in:
Glenn Morris 2013-05-08 23:09:39 -07:00
parent 2dee4d5e14
commit d631786abe
2 changed files with 85 additions and 74 deletions

View file

@ -1,6 +1,18 @@
2013-05-09 Glenn Morris <rgm@gnu.org> 2013-05-09 Glenn Morris <rgm@gnu.org>
* cus-test.el: No need to provide bbdb, bbdb-com any more. * cus-test.el: No need to provide bbdb, bbdb-com any more.
(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.
2013-05-07 Paul Eggert <eggert@cs.ucla.edu> 2013-05-07 Paul Eggert <eggert@cs.ucla.edu>

View file

@ -99,18 +99,17 @@
(defvar cus-test-skip-list nil (defvar cus-test-skip-list nil
"List of variables to disregard by `cus-test-apropos'.") "List of variables to disregard by `cus-test-apropos'.")
(defvar cus-test-libs-noloads nil ;; Loading dunnet in batch mode leads to a Dead end.
"List of libraries not to load by `cus-test-load-libs'.") (defvar cus-test-libs-noloads '("play/dunnet.el")
"List of files not to load by `cus-test-load-libs'.
Names should be as they appear in loaddefs.el.")
;; This avoids a hang of `cus-test-apropos' in 21.2. ;; This avoids a hang of `cus-test-apropos' in 21.2.
;; (add-to-list 'cus-test-skip-list 'sh-alias-alist) ;; (add-to-list 'cus-test-skip-list 'sh-alias-alist)
;; Loading dunnet in batch mode leads to a Dead end. (or noninteractive
(let (noninteractive) (load "dunnet")) ;; Never Viperize.
(add-to-list 'cus-test-libs-noloads "dunnet") (setq viper-mode nil))
;; Never Viperize.
(setq viper-mode nil)
;; Don't create a file `save-place-file'. ;; Don't create a file `save-place-file'.
(eval-after-load "saveplace" (eval-after-load "saveplace"
@ -259,49 +258,49 @@ The detected problematic options are stored in `cus-test-errors'."
(defun cus-test-load-custom-loads () (defun cus-test-load-custom-loads ()
"Call `custom-load-symbol' on all atoms." "Call `custom-load-symbol' on all atoms."
(interactive) (interactive)
(if noninteractive (let (noninteractive) (require 'dunnet)))
(mapatoms 'custom-load-symbol) (mapatoms 'custom-load-symbol)
(run-hooks 'cus-test-after-load-libs-hook)) (run-hooks 'cus-test-after-load-libs-hook))
(defmacro cus-test-load-1 (&rest body)
`(progn
(setq cus-test-libs-errors nil
cus-test-libs-loaded nil)
,@body
(message "%s libraries loaded successfully"
(length cus-test-libs-loaded))
(if (not cus-test-libs-errors)
(message "No load problems encountered")
(message "The following load problems appeared:")
(cus-test-message cus-test-libs-errors))
(run-hooks 'cus-test-after-load-libs-hook)))
;; This is just cus-test-libs, but loading in the current Emacs process.
(defun cus-test-load-libs () (defun cus-test-load-libs ()
"Load the libraries with autoloads. "Load the libraries with autoloads.
Don't load libraries in `cus-test-libs-noloads'." Don't load libraries in `cus-test-libs-noloads'."
(interactive) (interactive)
(setq cus-test-libs-errors nil) (cus-test-load-1
(setq cus-test-libs-loaded nil) (let ((lispdir (file-name-directory (locate-library "loaddefs"))))
(mapc (mapc
(lambda (file) (lambda (file)
(condition-case alpha (condition-case alpha
(unless (member file cus-test-libs-noloads) (unless (member file cus-test-libs-noloads)
(load file) (load (file-name-sans-extension (expand-file-name file lispdir)))
(push file cus-test-libs-loaded)) (push file cus-test-libs-loaded))
(error (error
(push (cons file alpha) cus-test-libs-errors) (push (cons file alpha) cus-test-libs-errors)
(message "Error for %s: %s" file alpha)))) (message "Error for %s: %s" file alpha))))
(cus-test-get-autoload-deps)) (cus-test-get-autoload-deps)))))
(message "%s libraries loaded successfully"
(length cus-test-libs-loaded))
(if (not cus-test-libs-errors)
(message "No load problems encountered")
(message "The following load problems appeared:")
(cus-test-message cus-test-libs-errors))
(run-hooks 'cus-test-after-load-libs-hook))
(defun cus-test-get-autoload-deps () (defun cus-test-get-autoload-deps ()
"Return the list of libraries with autoloads." "Return the list of files with autoloads."
(with-temp-buffer (with-temp-buffer
(insert-file-contents (locate-library "loaddefs")) (insert-file-contents (locate-library "loaddefs"))
;; This is from `customize-option'. (let (files)
(let (deps file) (while (search-forward "\n;;; Generated autoloads from " nil t)
(while (push (buffer-substring (match-end 0) (line-end-position)) files))
(search-forward "\n;;; Generated autoloads from " nil t) files)))
(goto-char (match-end 0))
(setq file (buffer-substring (point)
(progn (end-of-line) (point))))
(setq file (file-name-nondirectory file))
(string-match "\\.el\\'" file)
(setq file (substring file 0 (match-beginning 0)))
(setq deps (nconc deps (list file))))
deps)))
(defun cus-test-message (list) (defun cus-test-message (list)
"Print the members of LIST line by line." "Print the members of LIST line by line."
@ -349,7 +348,8 @@ in the Emacs source directory."
((symbolp load) ((symbolp load)
;; (condition-case nil (require load) (error nil)) ;; (condition-case nil (require load) (error nil))
(condition-case alpha (condition-case alpha
(unless (featurep load) (unless (or (featurep load)
(and noninteractive (eq load 'dunnet)))
(require load) (require load)
(push (list symbol load) cus-test-deps-required)) (push (list symbol load) cus-test-deps-required))
(error (error
@ -406,42 +406,41 @@ in the Emacs source directory."
This function is useful to detect load problems of libraries. This function is useful to detect load problems of libraries.
It is suitable for batch mode. E.g., invoke It is suitable for batch mode. E.g., invoke
src/emacs -batch -l admin/cus-test.el -f cus-test-libs ./src/emacs -batch -l admin/cus-test.el -f cus-test-libs
in the Emacs source directory." in the Emacs source directory."
(interactive) (interactive)
(with-temp-buffer (cus-test-load-1
(setq cus-test-libs-errors nil) (let ((default-directory source-directory)
(setq cus-test-libs-loaded nil) (emacs (expand-file-name "src/emacs"))
(cd source-directory) skipped)
(if (not (file-executable-p "src/emacs")) (or (file-executable-p emacs)
(error "No Emacs executable in %ssrc" default-directory)) (error "No Emacs executable in %ssrc" default-directory))
(mapc (mapc
(lambda (file) (lambda (file)
(condition-case alpha (if (member file cus-test-libs-noloads)
(let (fn cmd status) (push file skipped)
(setq fn (locate-library file)) (condition-case alpha
(if (not fn) (let* ((fn (expand-file-name file "lisp/"))
(error "Library %s not found" file)) (elc (concat fn "c"))
(setq cmd (concat "src/emacs -batch -l " fn)) status)
(setq status (call-process shell-file-name nil nil nil (if (file-readable-p elc) ; load compiled if present (faster)
shell-command-switch cmd)) (setq fn elc)
(if (equal status 0) (or (file-readable-p fn)
(message "%s" file) (error "Library %s not found" file)))
(error "%s" status)) (if (equal 0 (setq status (call-process emacs nil nil nil
(push file cus-test-libs-loaded)) "-batch" "-l" fn)))
(error (message "%s" file)
(push (cons file alpha) cus-test-libs-errors) (error "%s" status))
(message "Error for %s: %s" file alpha)))) (push file cus-test-libs-loaded))
(cus-test-get-autoload-deps)) (error
(message "Default Directory: %s" default-directory) (push (cons file alpha) cus-test-libs-errors)
(message "%s libraries had no load errors" (message "Error for %s: %s" file alpha)))))
(length cus-test-libs-loaded)) (cus-test-get-autoload-deps))
(if (not cus-test-libs-errors) (message "Default directory: %s" default-directory)
(message "No load problems encountered") (when skipped
(message "The following load problems appeared:") (message "The following libraries were skipped:")
(cus-test-message cus-test-libs-errors)) (cus-test-message skipped)))))
(run-hooks 'cus-test-after-load-libs-hook)))
(defun cus-test-noloads () (defun cus-test-noloads ()
"Find custom options not loaded by `custom-load-symbol'. "Find custom options not loaded by `custom-load-symbol'.