- (setq cus-test-libs-errors nil)
- (setq cus-test-libs-loaded nil)
- (set-buffer (find-file-noselect (locate-library "loaddefs")))
- (goto-char (point-min))
- (let (file)
- (while
- (search-forward "\n;;; Generated autoloads from " nil t)
- (goto-char (match-end 0))
- (setq file (buffer-substring (point)
- (progn (end-of-line) (point))))
- ;; If it is, load that library.
- (when file
- (setq file (file-name-nondirectory file))
- (when (string-match "\\.el\\'" file)
- (setq file (substring file 0 (match-beginning 0)))))
- (condition-case alpha
- (unless (member file cus-test-libs-noloads)
- (load-library file)
- (push file cus-test-libs-loaded))
- (error
- (push (cons file alpha) cus-test-libs-errors)
- (message "Error for %s: %s" file alpha)))))
- (message "Cus Test Libs loaded %s files."
- (length cus-test-libs-loaded))
- (if cus-test-libs-errors
- (message "The following load problems appeared:\n%s"
- cus-test-libs-errors)
- (message "No load problems encountered by Cus Test Libs"))
- (run-hooks 'cus-test-after-load-libs-hook))
+ (with-temp-buffer
+ (setq cus-test-libs-errors nil)
+ (setq cus-test-libs-loaded nil)
+ (cd source-directory)
+ (if (not (file-executable-p "src/emacs"))
+ (error "No Emacs executable in %ssrc" default-directory))
+ (mapc
+ (lambda (file)
+ (condition-case alpha
+ (let (fn cmd status)
+ (setq fn (locate-library file))
+ (if (not fn)
+ (error "Library %s not found" file))
+ (setq cmd (concat "src/emacs -batch -l " fn))
+ (setq status (call-process shell-file-name nil nil nil
+ shell-command-switch cmd))
+ (if (equal status 0)
+ (message "%s" file)
+ (error "%s" status))
+ (push file cus-test-libs-loaded))
+ (error
+ (push (cons file alpha) cus-test-libs-errors)
+ (message "Error for %s: %s" file alpha))))
+ (cus-test-get-autoload-deps))
+ (message "Default Directory: %s" default-directory)
+ (message "%s libraries had no load errors"
+ (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-noloads ()
+ "Find custom options not loaded by `custom-load-symbol'.
+Calling this function after `cus-test-load-libs' is not meaningful.
+It is suitable for batch mode. E.g., invoke
+
+ src/emacs -batch -l admin/cus-test.el -f cus-test-noloads
+
+in the Emacs source directory."
+ (interactive)
+ (let (cus-loaded)
+
+ (message "Running %s" 'cus-test-load-custom-loads)
+ (cus-test-load-custom-loads)
+ (setq cus-loaded
+ (cus-test-get-options ""))
+
+ (message "Running %s" 'cus-test-load-libs)
+ (cus-test-load-libs)
+ (setq cus-test-vars-not-cus-loaded
+ (cus-test-get-options ""))
+
+ (dolist (o cus-loaded)
+ (setq cus-test-vars-not-cus-loaded
+ (delete o cus-test-vars-not-cus-loaded)))
+
+ (if (not cus-test-vars-not-cus-loaded)
+ (message "No options not loaded by custom-load-symbol found")
+ (message "The following options were not loaded by custom-load-symbol:")
+ (cus-test-message
+ (sort cus-test-vars-not-cus-loaded 'string<)))))
+
+;; And last but not least a quiz:
+;;
+;; Evaluation of the form (customize-option 'debug-on-error) yields a
+;; *Customize* buffer with a mismatch mess. Why?