From a3f276d8ffee80c17919aea509400767d800d4bb Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 10 May 2013 00:31:34 -0700 Subject: [PATCH] Add option for cus-test.el to load all Lisp files * admin/cus-test.el (cus-test-libs-noloads): Add some files. (cus-test-get-lisp-files): New function. (cus-test-libs): Add option to load more/all Lisp files. --- admin/ChangeLog | 6 ++++++ admin/cus-test.el | 33 +++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/admin/ChangeLog b/admin/ChangeLog index 830854c8e63..8ae595df980 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,9 @@ +2013-05-10 Glenn Morris + + * cus-test.el (cus-test-libs-noloads): Add some files. + (cus-test-get-lisp-files): New function. + (cus-test-libs): Add option to load more/all Lisp files. + 2013-05-09 Glenn Morris * cus-test.el: No need to provide bbdb, bbdb-com any more. diff --git a/admin/cus-test.el b/admin/cus-test.el index bce5f5da3cf..90fb40b77c2 100644 --- a/admin/cus-test.el +++ b/admin/cus-test.el @@ -100,7 +100,8 @@ "List of variables to disregard by `cus-test-apropos'.") ;; Loading dunnet in batch mode leads to a Dead end. -(defvar cus-test-libs-noloads '("play/dunnet.el") +(defvar cus-test-libs-noloads '("play/dunnet.el" "emulation/edt-mapper.el" + "loadup.el" "mail/blessmail.el") "List of files not to load by `cus-test-load-libs'. Names should be as they appear in loaddefs.el.") @@ -302,6 +303,22 @@ Don't load libraries in `cus-test-libs-noloads'." (push (buffer-substring (match-end 0) (line-end-position)) files)) files))) +(defun cus-test-get-lisp-files (&optional all) + "Return list of all Lisp files with defcustoms. +Optional argument ALL non-nil means list all Lisp files." + (let ((default-directory (expand-file-name "lisp/" source-directory)) + (msg "Finding files...")) + (message "%s" msg) + (prog1 + ;; Hack to remove leading "./". + (mapcar (lambda (e) (substring e 2)) + (apply 'process-lines find-program + "-name" "*.el" + (unless all + (list "-exec" grep-program + "-l" "^[ \t]*(defcustom" "{}" "+")))) + (message "%sdone" msg)))) + (defun cus-test-message (list) "Print the members of LIST line by line." (dolist (m list) (message "%s" m))) @@ -401,15 +418,21 @@ in the Emacs source directory." (cus-test-message cus-test-deps-errors)) (run-hooks 'cus-test-after-load-libs-hook)) -(defun cus-test-libs () +(defun cus-test-libs (&optional more) "Load the libraries with autoloads in separate processes. This function is useful to detect load problems of libraries. It is suitable for batch mode. E.g., invoke ./src/emacs -batch -l admin/cus-test.el -f cus-test-libs -in the Emacs source directory." +in the Emacs source directory. + +If optional argument MORE is \"defcustom\", load all files with defcustoms. +If it is \"all\", load all Lisp files." (interactive) + (and noninteractive + command-line-args-left + (setq more (pop command-line-args-left))) (cus-test-load-1 (let ((default-directory source-directory) (emacs (expand-file-name "src/emacs")) @@ -436,7 +459,9 @@ in the Emacs source directory." (error (push (cons file alpha) cus-test-libs-errors) (message "Error for %s: %s" file alpha))))) - (cus-test-get-autoload-deps)) + (if more + (cus-test-get-lisp-files (equal more "all")) + (cus-test-get-autoload-deps))) (message "Default directory: %s" default-directory) (when skipped (message "The following libraries were skipped:") -- 2.39.2