2021-01-31 23:00:39 +00:00
|
|
|
|
;;; cus-test.el --- tests for custom types and load problems -*- lexical-binding: t; -*-
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
2022-01-01 07:45:51 +00:00
|
|
|
|
;; Copyright (C) 1998, 2000, 2002-2022 Free Software Foundation, Inc.
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
2019-05-26 07:58:27 +00:00
|
|
|
|
;; Author: Markus Rost <rost@math.uni-bielefeld.de>
|
2002-10-08 18:42:36 +00:00
|
|
|
|
;; Created: 13 Sep 1998
|
|
|
|
|
;; Keywords: maint
|
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-09 23:48:10 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2002-10-08 18:42:36 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-09 23:48:10 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
2002-10-13 02:47:54 +00:00
|
|
|
|
;; This file provides simple tests to detect custom options with
|
|
|
|
|
;; incorrect customization types and load problems for custom and
|
|
|
|
|
;; autoload dependencies.
|
2002-10-08 18:42:36 +00:00
|
|
|
|
;;
|
2002-10-13 02:47:54 +00:00
|
|
|
|
;; The basic tests can be run in batch mode. Invoke them with
|
|
|
|
|
;;
|
2013-05-14 02:12:19 +00:00
|
|
|
|
;; src/emacs -batch -l admin/cus-test.el -f cus-test-opts [all]
|
2002-10-13 02:47:54 +00:00
|
|
|
|
;;
|
|
|
|
|
;; src/emacs -batch -l admin/cus-test.el -f cus-test-deps
|
|
|
|
|
;;
|
2013-05-14 02:12:19 +00:00
|
|
|
|
;; src/emacs -batch -l admin/cus-test.el -f cus-test-libs [all]
|
2002-10-13 02:47:54 +00:00
|
|
|
|
;;
|
2002-10-16 04:41:59 +00:00
|
|
|
|
;; src/emacs -batch -l admin/cus-test.el -f cus-test-noloads
|
|
|
|
|
;;
|
2021-02-19 11:31:56 +00:00
|
|
|
|
;; or as a part of the test suite with
|
|
|
|
|
;;
|
|
|
|
|
;; make -C test test-custom-opts
|
|
|
|
|
;; make -C test test-custom-deps
|
|
|
|
|
;; make -C test test-custom-libs
|
|
|
|
|
;; make -C test test-custom-noloads
|
|
|
|
|
;;
|
2002-10-13 02:47:54 +00:00
|
|
|
|
;; in the emacs source directory.
|
|
|
|
|
;;
|
|
|
|
|
;; For interactive use: Load this file. Then
|
2002-10-08 18:42:36 +00:00
|
|
|
|
;;
|
|
|
|
|
;; M-x cus-test-apropos REGEXP RET
|
|
|
|
|
;;
|
|
|
|
|
;; checks the options matching REGEXP. In particular
|
|
|
|
|
;;
|
|
|
|
|
;; M-x cus-test-apropos RET
|
|
|
|
|
;;
|
|
|
|
|
;; checks all options. The detected options are stored in the
|
|
|
|
|
;; variable `cus-test-errors'.
|
|
|
|
|
;;
|
|
|
|
|
;; Only those options are checked which have been already loaded.
|
|
|
|
|
;; Therefore `cus-test-apropos' is more efficient after loading many
|
|
|
|
|
;; libraries.
|
|
|
|
|
;;
|
2002-10-13 02:47:54 +00:00
|
|
|
|
;; M-x cus-test-load-custom-loads
|
|
|
|
|
;;
|
|
|
|
|
;; loads all (!) custom dependencies and
|
2002-10-08 18:42:36 +00:00
|
|
|
|
;;
|
2002-10-13 02:47:54 +00:00
|
|
|
|
;; M-x cus-test-load-libs
|
|
|
|
|
;;
|
|
|
|
|
;; loads all (!) libraries with autoloads.
|
2002-10-08 18:42:36 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Options with a custom-get property, usually defined by a :get
|
2002-10-09 22:40:24 +00:00
|
|
|
|
;; declaration, are stored in the variable
|
|
|
|
|
;;
|
|
|
|
|
;; `cus-test-vars-with-custom-get'
|
|
|
|
|
;;
|
|
|
|
|
;; Options with a state of 'changed ("changed outside the customize
|
|
|
|
|
;; buffer") are stored in the variable
|
|
|
|
|
;;
|
|
|
|
|
;; `cus-test-vars-with-changed-state'
|
|
|
|
|
;;
|
|
|
|
|
;; These lists are prepared just in case one wants to investigate
|
|
|
|
|
;; those options further.
|
|
|
|
|
;;
|
2002-10-13 02:47:54 +00:00
|
|
|
|
;; The command `cus-test-opts' tests many (all?) custom options.
|
2002-10-09 22:40:24 +00:00
|
|
|
|
;;
|
2002-10-13 02:47:54 +00:00
|
|
|
|
;; The command `cus-test-deps' is like `cus-test-load-custom-loads'
|
|
|
|
|
;; but reports about load errors.
|
2002-10-10 22:50:35 +00:00
|
|
|
|
;;
|
2002-10-13 02:47:54 +00:00
|
|
|
|
;; The command `cus-test-libs' runs for all libraries with autoloads
|
|
|
|
|
;; separate emacs processes of the form "emacs -batch -l LIB".
|
2002-10-10 22:50:35 +00:00
|
|
|
|
;;
|
2002-10-16 04:41:59 +00:00
|
|
|
|
;; The command `cus-test-noloads' returns a list of variables which
|
|
|
|
|
;; are somewhere declared as custom options, but not loaded by
|
|
|
|
|
;; `custom-load-symbol'.
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
2002-10-15 05:15:40 +00:00
|
|
|
|
|
2002-10-10 22:50:35 +00:00
|
|
|
|
;;; Code:
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
2002-10-13 02:47:54 +00:00
|
|
|
|
;;; Workarounds. For a smooth run and to avoid some side effects.
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
2002-10-09 22:40:24 +00:00
|
|
|
|
(defvar cus-test-after-load-libs-hook nil
|
2002-10-13 02:47:54 +00:00
|
|
|
|
"Used to switch off undesired side effects of loading libraries.")
|
|
|
|
|
|
|
|
|
|
(defvar cus-test-skip-list nil
|
|
|
|
|
"List of variables to disregard by `cus-test-apropos'.")
|
2002-10-09 22:40:24 +00:00
|
|
|
|
|
2013-05-11 02:29:57 +00:00
|
|
|
|
(defvar cus-test-libs-noloads
|
|
|
|
|
;; Loading dunnet in batch mode leads to a Dead end.
|
|
|
|
|
;; blessmail writes a file.
|
|
|
|
|
;; characters cannot be loaded twice ("Category `a' is already defined").
|
|
|
|
|
'("play/dunnet.el" "emulation/edt-mapper.el"
|
|
|
|
|
"loadup.el" "mail/blessmail.el" "international/characters.el"
|
|
|
|
|
"cedet/ede/loaddefs.el" "cedet/semantic/loaddefs.el"
|
|
|
|
|
"net/tramp-loaddefs.el")
|
2013-05-09 06:09:39 +00:00
|
|
|
|
"List of files not to load by `cus-test-load-libs'.
|
|
|
|
|
Names should be as they appear in loaddefs.el.")
|
2002-10-13 02:47:54 +00:00
|
|
|
|
|
|
|
|
|
;; This avoids a hang of `cus-test-apropos' in 21.2.
|
|
|
|
|
;; (add-to-list 'cus-test-skip-list 'sh-alias-alist)
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
2021-01-31 23:00:39 +00:00
|
|
|
|
(defvar viper-mode)
|
2013-05-09 06:09:39 +00:00
|
|
|
|
(or noninteractive
|
|
|
|
|
;; Never Viperize.
|
|
|
|
|
(setq viper-mode nil))
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
2002-10-10 22:50:35 +00:00
|
|
|
|
;; Don't create a file `save-place-file'.
|
2002-10-08 18:42:36 +00:00
|
|
|
|
(eval-after-load "saveplace"
|
|
|
|
|
'(remove-hook 'kill-emacs-hook 'save-place-kill-emacs-hook))
|
|
|
|
|
|
2002-10-10 22:50:35 +00:00
|
|
|
|
;; Don't create a file `abbrev-file-name'.
|
2002-10-08 18:42:36 +00:00
|
|
|
|
(setq save-abbrevs nil)
|
|
|
|
|
|
2022-11-20 11:59:39 +00:00
|
|
|
|
;; Avoid compile logs from advised functions.
|
2002-10-08 18:42:36 +00:00
|
|
|
|
(eval-after-load "bytecomp"
|
|
|
|
|
'(setq ad-default-compilation-action 'never))
|
|
|
|
|
|
2002-10-13 02:47:54 +00:00
|
|
|
|
|
|
|
|
|
;;; Main code:
|
|
|
|
|
|
2002-10-08 18:42:36 +00:00
|
|
|
|
;; We want to log all messages.
|
|
|
|
|
(setq message-log-max t)
|
|
|
|
|
|
2002-10-10 22:50:35 +00:00
|
|
|
|
(require 'cus-edit)
|
|
|
|
|
(require 'cus-load)
|
|
|
|
|
|
2002-10-08 18:42:36 +00:00
|
|
|
|
(defvar cus-test-errors nil
|
|
|
|
|
"List of problematic variables found by `cus-test-apropos'.")
|
|
|
|
|
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(defvar cus-test-tested-variables nil
|
|
|
|
|
"List of options tested by last call of `cus-test-apropos'.")
|
|
|
|
|
|
2002-10-16 04:41:59 +00:00
|
|
|
|
;; I haven't understood this :get stuff. The symbols with a
|
|
|
|
|
;; custom-get property are stored here.
|
|
|
|
|
(defvar cus-test-vars-with-custom-get nil
|
|
|
|
|
"Set by `cus-test-apropos' to a list of options with :get property.")
|
|
|
|
|
|
|
|
|
|
(defvar cus-test-vars-with-changed-state nil
|
2022-04-22 14:17:22 +00:00
|
|
|
|
"Set by `cus-test-apropos' to a list of options with state \\='changed.")
|
2002-10-16 04:41:59 +00:00
|
|
|
|
|
2002-10-10 22:50:35 +00:00
|
|
|
|
(defvar cus-test-deps-errors nil
|
|
|
|
|
"List of require/load problems found by `cus-test-deps'.")
|
|
|
|
|
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(defvar cus-test-deps-required nil
|
|
|
|
|
"List of dependencies required by `cus-test-deps'.
|
|
|
|
|
Only unloaded features will be require'd.")
|
|
|
|
|
|
2002-10-10 23:25:11 +00:00
|
|
|
|
(defvar cus-test-deps-loaded nil
|
2002-10-13 02:47:54 +00:00
|
|
|
|
"List of dependencies loaded by `cus-test-deps'.")
|
2002-10-10 22:50:35 +00:00
|
|
|
|
|
|
|
|
|
(defvar cus-test-libs-errors nil
|
2002-10-13 02:47:54 +00:00
|
|
|
|
"List of load problems found by `cus-test-load-libs' or `cus-test-libs'.")
|
2002-10-10 22:50:35 +00:00
|
|
|
|
|
|
|
|
|
(defvar cus-test-libs-loaded nil
|
2002-10-13 02:47:54 +00:00
|
|
|
|
"List of files loaded by `cus-test-load-libs' or `cus-test-libs'.")
|
2002-10-10 22:50:35 +00:00
|
|
|
|
|
2002-10-16 04:41:59 +00:00
|
|
|
|
(defvar cus-test-vars-not-cus-loaded nil
|
|
|
|
|
"A list of options not loaded by `custom-load-symbol'.
|
|
|
|
|
Set by `cus-test-noloads'.")
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
2002-10-16 04:41:59 +00:00
|
|
|
|
;; (defvar cus-test-vars-cus-loaded nil
|
|
|
|
|
;; "A list of options loaded by `custom-load-symbol'.")
|
2002-10-09 22:40:24 +00:00
|
|
|
|
|
2002-10-08 18:42:36 +00:00
|
|
|
|
(defun cus-test-apropos (regexp)
|
|
|
|
|
"Check the options matching REGEXP.
|
|
|
|
|
The detected problematic options are stored in `cus-test-errors'."
|
|
|
|
|
(interactive "sVariable regexp: ")
|
|
|
|
|
(setq cus-test-errors nil)
|
|
|
|
|
(setq cus-test-tested-variables nil)
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(mapc
|
2002-10-08 18:42:36 +00:00
|
|
|
|
(lambda (symbol)
|
|
|
|
|
(push symbol cus-test-tested-variables)
|
2002-10-13 02:47:54 +00:00
|
|
|
|
;; Be verbose in case we hang.
|
|
|
|
|
(message "Cus Test running...%s %s"
|
|
|
|
|
(length cus-test-tested-variables) symbol)
|
2002-10-08 18:42:36 +00:00
|
|
|
|
(condition-case alpha
|
2013-12-28 08:33:44 +00:00
|
|
|
|
;; FIXME This defaults to 'sexp if no type was specified.
|
|
|
|
|
;; Always report such instances as a type mismatch.
|
|
|
|
|
;; Currently abusing cusver-scan to do that.
|
2002-10-08 18:42:36 +00:00
|
|
|
|
(let* ((type (custom-variable-type symbol))
|
|
|
|
|
(conv (widget-convert type))
|
|
|
|
|
(get (or (get symbol 'custom-get) 'default-value))
|
|
|
|
|
values
|
|
|
|
|
mismatch)
|
|
|
|
|
(when (default-boundp symbol)
|
2002-10-10 22:50:35 +00:00
|
|
|
|
(push (funcall get symbol) values)
|
2021-01-31 23:00:39 +00:00
|
|
|
|
(push (eval (car (get symbol 'standard-value)) t) values))
|
2002-10-08 18:42:36 +00:00
|
|
|
|
(if (boundp symbol)
|
2002-10-10 22:50:35 +00:00
|
|
|
|
(push (symbol-value symbol) values))
|
2002-10-08 18:42:36 +00:00
|
|
|
|
;; That does not work.
|
2002-10-10 22:50:35 +00:00
|
|
|
|
;; (push (widget-get conv :value) values)
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
|
|
|
|
;; Check the values
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(mapc (lambda (value)
|
2013-08-13 07:42:51 +00:00
|
|
|
|
;; TODO for booleans, check for values that can be
|
|
|
|
|
;; evaluated and are not t or nil. Usually a bug.
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(unless (widget-apply conv :match value)
|
|
|
|
|
(setq mismatch 'mismatch)))
|
|
|
|
|
values)
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
2002-10-10 22:50:35 +00:00
|
|
|
|
;; Store symbols with a custom-get property.
|
|
|
|
|
(when (get symbol 'custom-get)
|
2002-10-14 22:20:42 +00:00
|
|
|
|
(add-to-list 'cus-test-vars-with-custom-get symbol))
|
2002-10-10 22:50:35 +00:00
|
|
|
|
|
2002-10-08 18:42:36 +00:00
|
|
|
|
;; Changed outside the customize buffer?
|
2002-10-09 22:40:24 +00:00
|
|
|
|
;; This routine is not very much tested.
|
|
|
|
|
(let ((c-value
|
|
|
|
|
(or (get symbol 'customized-value)
|
|
|
|
|
(get symbol 'saved-value)
|
|
|
|
|
(get symbol 'standard-value))))
|
|
|
|
|
(and (consp c-value)
|
|
|
|
|
(boundp symbol)
|
2021-01-31 23:00:39 +00:00
|
|
|
|
(not (equal (eval (car c-value) t) (symbol-value symbol)))
|
2002-10-14 22:20:42 +00:00
|
|
|
|
(add-to-list 'cus-test-vars-with-changed-state symbol)))
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
|
|
|
|
(if mismatch
|
2002-10-10 22:50:35 +00:00
|
|
|
|
(push symbol cus-test-errors)))
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
|
|
|
|
(error
|
2002-10-10 22:50:35 +00:00
|
|
|
|
(push symbol cus-test-errors)
|
|
|
|
|
(message "Error for %s: %s" symbol alpha))))
|
2002-10-08 18:42:36 +00:00
|
|
|
|
(cus-test-get-options regexp))
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(message "%s options tested"
|
2002-10-08 18:42:36 +00:00
|
|
|
|
(length cus-test-tested-variables))
|
2002-10-10 22:50:35 +00:00
|
|
|
|
(cus-test-errors-display))
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
2013-05-16 00:20:34 +00:00
|
|
|
|
(defun cus-test-cus-load-groups (&optional cus-load)
|
|
|
|
|
"Return a list of current custom groups.
|
|
|
|
|
If CUS-LOAD is non-nil, include groups from cus-load.el."
|
2021-01-31 23:00:39 +00:00
|
|
|
|
(append (mapcar #'cdr custom-current-group-alist)
|
2013-05-16 00:20:34 +00:00
|
|
|
|
(if cus-load
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(insert-file-contents (locate-library "cus-load.el"))
|
|
|
|
|
(search-forward "(put '")
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(let (res)
|
|
|
|
|
(while (and (looking-at "^(put '\\(\\S-+\\)")
|
|
|
|
|
(zerop (forward-line 1)))
|
|
|
|
|
(push (intern (match-string 1)) res))
|
|
|
|
|
res)))))
|
|
|
|
|
|
|
|
|
|
(defun cus-test-get-options (regexp &optional group)
|
|
|
|
|
"Return a list of custom options matching REGEXP.
|
|
|
|
|
If GROUP is non-nil, return groups rather than options.
|
|
|
|
|
If GROUP is `cus-load', include groups listed in cus-loads as well as
|
|
|
|
|
currently defined groups."
|
|
|
|
|
(let ((groups (if group (cus-test-cus-load-groups (eq group 'cus-load))))
|
|
|
|
|
found)
|
2002-10-08 18:42:36 +00:00
|
|
|
|
(mapatoms
|
|
|
|
|
(lambda (symbol)
|
|
|
|
|
(and
|
2013-05-16 00:20:34 +00:00
|
|
|
|
(if group
|
|
|
|
|
(memq symbol groups)
|
|
|
|
|
(or
|
Delete many items obsolete since 24.3
* lisp/allout.el (allout-exposure-change-hook)
(allout-structure-added-hook, allout-structure-deleted-hook)
(allout-structure-shifted-hook):
* lisp/arc-mode.el (archive-extract-hooks):
* lisp/buff-menu.el (Buffer-menu-buffer+size-width):
* lisp/calendar/timeclock.el (timeclock-modeline-display)
(timeclock-modeline-display, timeclock-update-modeline):
* lisp/cedet/semantic/db-el.el
(semanticdb-elisp-sym-function-arglist):
* lisp/cedet/semantic/db-file.el (semanticdb-save-database-hooks):
* lisp/cedet/semantic/edit.el (semantic-change-hooks)
(semantic-edits-new-change-hooks)
(semantic-edits-delete-change-hooks)
(semantic-edits-reparse-change-hooks):
* lisp/cedet/semantic/lex.el (semantic-lex-reset-hooks):
* lisp/comint.el (comint--unquote&expand-filename)
(comint-unquote-filename):
* lisp/custom.el (user-variable-p):
* lisp/dired.el (dired-shrink-to-fit, dired-pop-to-buffer)
(dired-sort-set-modeline):
* lisp/ebuff-menu.el (Electric-buffer-menu-mode):
* lisp/emacs-lisp/byte-run.el (macro-declaration-function):
* lisp/emacs-lisp/checkdoc.el (custom-print-functions)
(checkdoc-comment-style-hooks):
* lisp/emacs-lisp/cl-lib.el (custom-print-functions):
* lisp/emacs-lisp/edebug.el (gud-inhibit-global-bindings):
* lisp/erc/erc-dcc.el (erc-dcc-chat-filter-hook):
* lisp/eshell/esh-mode.el (eshell-status-in-modeline):
* lisp/eshell/eshell.el (eshell-add-to-window-buffer-names)
(eshell-remove-from-window-buffer-names):
* lisp/faces.el (set-face-underline-p, font-list-limit):
* lisp/files.el (automount-dir-prefix, toggle-read-only):
* lisp/filesets.el (filesets-cache-fill-content-hooks):
* lisp/frame.el (automatic-hscrolling):
* lisp/generic-x.el (javascript-generic-mode)
(javascript-generic-mode-hook):
* lisp/gnus/gnus-start.el (gnus-subscribe-newsgroup-hooks):
* lisp/gnus/nndiary.el (nndiary-request-create-group-hooks)
(nndiary-request-update-info-hooks)
(nndiary-request-accept-article-hooks):
* lisp/htmlfontify.el (hfy-post-html-hooks):
* lisp/international/mule-cmds.el
(inactivate-current-input-method-function)
(inactivate-input-method, input-method-inactivate-hook)
(ucs-insert):
* lisp/international/quail.el (quail-inactivate)
(quail-inactivate-hook):
* lisp/international/robin.el (robin-inactivate)
(robin-inactivate-hook):
* lisp/leim/quail/hangul.el (hangul-input-method-inactivate):
* lisp/leim/quail/uni-input.el (ucs-input-inactivate):
* lisp/mail/emacsbug.el (report-emacs-bug-info):
* lisp/mh-e/mh-e.el (mh-kill-folder-suppress-prompt-hooks):
* lisp/mpc.el (mpc-string-prefix-p):
* lisp/net/rcirc.el (rcirc-print-hooks, rcirc-sentinel-hooks)
(rcirc-receive-message-hooks, rcirc-activity-hooks):
* lisp/obsolete/crisp.el (crisp-mode-modeline-string):
* lisp/pcomplete.el (pcomplete-arg-quote-list)
(pcomplete-quote-argument):
* lisp/progmodes/cc-mode.el (c-prepare-bug-report-hooks):
* lisp/progmodes/python.el (python-info-ppss-context)
(python-info-ppss-context-type)
(python-info-ppss-comment-or-string-p, python-indent)
(python-guess-indent, python-buffer, python-preoutput-result)
(python-proc, python-send-receive, python-send-string)
(python-use-skeletons):
* lisp/progmodes/sh-script.el (sh-maybe-here-document):
* lisp/replace.el (query-replace-interactive):
* lisp/strokes.el (strokes-modeline-string):
* lisp/subr.el (redraw-modeline):
* lisp/term.el (term-default-fg-color, term-default-bg-color):
* lisp/textmodes/tex-mode.el (latex-string-prefix-p)
(tex-string-prefix-p):
* lisp/url/url-parse.el (url-recreate-url-attributes):
* lisp/vc/add-log.el (change-log-acknowledgement):
* lisp/vc/ediff-wind.el
(ediff-choose-window-setup-function-automatically):
* lisp/vc/pcvs-util.el (cvs-string-prefix-p):
* lisp/vc/vc.el (vc-string-prefix-p):
* lisp/window.el (display-buffer-function):
* lisp/winner.el (winner-mode-leave-hook): Remove many functions and
variables obsolete since 24.3.
* lisp/buff-menu.el (list-buffers--refresh):
* lisp/dired.el (dired-mode-map):
* lisp/files.el (abbreviate-file-name):
* lisp/generic-x.el (generic-default-modes):
* lisp/mh-e/mh-funcs.el (mh-kill-folder):
* lisp/progmodes/hideif.el (hide-ifdef-mode-submap):
* lisp/replace.el (query-replace-read-from):
* lisp/term.el (term):
* lisp/window.el (display-buffer): Don't use above deleted
functions and variables.
* src/marker.c (Fbuffer_has_markers_at): Delete DEFUN obsolete
since 24.3.
(syms_of_marker) <Sbuffer_has_markers_at>: Delete defsubr.
* lisp/subr.el (buffer-has-markers-at): Remove obsoletion
of above deleted DEFUN.
* etc/TODO: Doc fix; don't mention above deleted function.
* admin/cus-test.el (cus-test-get-options):
* lisp/pcomplete.el: Doc fixes; don't mention removed items.
; * etc/NEWS: List removed items.
2022-07-10 11:27:36 +00:00
|
|
|
|
;; (custom-variable-p symbol)
|
2013-05-16 00:20:34 +00:00
|
|
|
|
(get symbol 'standard-value)
|
|
|
|
|
;; (get symbol 'saved-value)
|
|
|
|
|
(get symbol 'custom-type)))
|
2002-10-08 18:42:36 +00:00
|
|
|
|
(string-match regexp (symbol-name symbol))
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(not (member symbol cus-test-skip-list))
|
2002-10-08 18:42:36 +00:00
|
|
|
|
(push symbol found))))
|
|
|
|
|
found))
|
|
|
|
|
|
|
|
|
|
(defun cus-test-errors-display ()
|
|
|
|
|
"Report about the errors found by cus-test."
|
|
|
|
|
(with-output-to-temp-buffer "*cus-test-errors*"
|
|
|
|
|
(set-buffer standard-output)
|
|
|
|
|
(insert (format "Cus Test tested %s variables.\
|
|
|
|
|
See `cus-test-tested-variables'.\n\n"
|
|
|
|
|
(length cus-test-tested-variables)))
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(if (not cus-test-errors)
|
|
|
|
|
(insert "No errors found by cus-test.")
|
|
|
|
|
(insert "The following variables seem to have problems:\n\n")
|
2002-10-16 04:41:59 +00:00
|
|
|
|
(dolist (e cus-test-errors)
|
|
|
|
|
(insert (symbol-name e) "\n")))))
|
2002-10-13 02:47:54 +00:00
|
|
|
|
|
|
|
|
|
(defun cus-test-load-custom-loads ()
|
2002-10-08 18:42:36 +00:00
|
|
|
|
"Call `custom-load-symbol' on all atoms."
|
|
|
|
|
(interactive)
|
2013-05-09 06:09:39 +00:00
|
|
|
|
(if noninteractive (let (noninteractive) (require 'dunnet)))
|
2021-01-31 23:00:39 +00:00
|
|
|
|
(mapatoms #'custom-load-symbol)
|
2002-10-09 22:40:24 +00:00
|
|
|
|
(run-hooks 'cus-test-after-load-libs-hook))
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
2013-05-09 06:09:39 +00:00
|
|
|
|
(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.
|
2013-05-11 02:29:57 +00:00
|
|
|
|
(defun cus-test-load-libs (&optional more)
|
2002-10-13 02:47:54 +00:00
|
|
|
|
"Load the libraries with autoloads.
|
2013-05-11 02:29:57 +00:00
|
|
|
|
Don't load libraries in `cus-test-libs-noloads'.
|
|
|
|
|
If optional argument MORE is \"defcustom\", load all files with defcustoms.
|
|
|
|
|
If it is \"all\", load all Lisp files."
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(interactive)
|
2013-05-09 06:09:39 +00:00
|
|
|
|
(cus-test-load-1
|
|
|
|
|
(let ((lispdir (file-name-directory (locate-library "loaddefs"))))
|
|
|
|
|
(mapc
|
|
|
|
|
(lambda (file)
|
|
|
|
|
(condition-case alpha
|
|
|
|
|
(unless (member file cus-test-libs-noloads)
|
2021-02-16 20:03:39 +00:00
|
|
|
|
(load (file-name-sans-extension (expand-file-name file lispdir))
|
|
|
|
|
nil t)
|
2013-05-09 06:09:39 +00:00
|
|
|
|
(push file cus-test-libs-loaded))
|
|
|
|
|
(error
|
|
|
|
|
(push (cons file alpha) cus-test-libs-errors)
|
|
|
|
|
(message "Error for %s: %s" file alpha))))
|
2013-05-11 02:29:57 +00:00
|
|
|
|
(if more
|
|
|
|
|
(cus-test-get-lisp-files (equal more "all"))
|
|
|
|
|
(cus-test-get-autoload-deps))))))
|
2002-10-13 02:47:54 +00:00
|
|
|
|
|
|
|
|
|
(defun cus-test-get-autoload-deps ()
|
2013-05-09 06:09:39 +00:00
|
|
|
|
"Return the list of files with autoloads."
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(insert-file-contents (locate-library "loaddefs"))
|
2013-05-09 06:09:39 +00:00
|
|
|
|
(let (files)
|
|
|
|
|
(while (search-forward "\n;;; Generated autoloads from " nil t)
|
|
|
|
|
(push (buffer-substring (match-end 0) (line-end-position)) files))
|
|
|
|
|
files)))
|
2002-10-13 02:47:54 +00:00
|
|
|
|
|
2013-05-10 07:31:34 +00:00
|
|
|
|
(defun cus-test-get-lisp-files (&optional all)
|
|
|
|
|
"Return list of all Lisp files with defcustoms.
|
2013-05-14 02:12:19 +00:00
|
|
|
|
Optional argument ALL non-nil means list all (non-obsolete) Lisp files."
|
2013-05-10 07:31:34 +00:00
|
|
|
|
(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))
|
2021-01-31 23:00:39 +00:00
|
|
|
|
(apply #'process-lines find-program
|
2020-09-29 09:24:38 +00:00
|
|
|
|
"." "-name" "obsolete" "-prune" "-o"
|
2021-02-16 20:01:25 +00:00
|
|
|
|
"-name" "ldefs-boot.el" "-prune" "-o"
|
|
|
|
|
"-name" "*loaddefs.el" "-prune" "-o"
|
2013-05-11 02:29:57 +00:00
|
|
|
|
"-name" "[^.]*.el" ; ignore .dir-locals.el
|
2013-05-14 02:12:19 +00:00
|
|
|
|
(if all
|
|
|
|
|
'("-print")
|
2013-05-10 07:31:34 +00:00
|
|
|
|
(list "-exec" grep-program
|
|
|
|
|
"-l" "^[ \t]*(defcustom" "{}" "+"))))
|
|
|
|
|
(message "%sdone" msg))))
|
|
|
|
|
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(defun cus-test-message (list)
|
|
|
|
|
"Print the members of LIST line by line."
|
|
|
|
|
(dolist (m list) (message "%s" m)))
|
|
|
|
|
|
|
|
|
|
|
2002-10-10 22:50:35 +00:00
|
|
|
|
;;; The routines for batch mode:
|
|
|
|
|
|
2013-05-11 02:29:57 +00:00
|
|
|
|
(defun cus-test-opts (&optional all)
|
2002-10-10 22:50:35 +00:00
|
|
|
|
"Test custom options.
|
|
|
|
|
This function is suitable for batch mode. E.g., invoke
|
|
|
|
|
|
|
|
|
|
src/emacs -batch -l admin/cus-test.el -f cus-test-opts
|
|
|
|
|
|
2013-05-11 02:29:57 +00:00
|
|
|
|
in the Emacs source directory.
|
|
|
|
|
Normally only tests options belonging to files in loaddefs.el.
|
2020-09-25 12:46:36 +00:00
|
|
|
|
If optional argument ALL is non-nil, test all files with defcustoms.
|
|
|
|
|
|
|
|
|
|
Returns a list of variables with suspicious types."
|
2002-10-10 22:50:35 +00:00
|
|
|
|
(interactive)
|
2013-05-11 02:29:57 +00:00
|
|
|
|
(and noninteractive
|
|
|
|
|
command-line-args-left
|
|
|
|
|
(setq all (pop command-line-args-left)))
|
2002-10-14 20:28:24 +00:00
|
|
|
|
(message "Running %s" 'cus-test-load-libs)
|
2013-05-11 02:29:57 +00:00
|
|
|
|
(cus-test-load-libs (if all "defcustom"))
|
2002-10-10 22:50:35 +00:00
|
|
|
|
(message "Running %s" 'cus-test-load-custom-loads)
|
|
|
|
|
(cus-test-load-custom-loads)
|
|
|
|
|
(message "Running %s" 'cus-test-apropos)
|
|
|
|
|
(cus-test-apropos "")
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(if (not cus-test-errors)
|
2020-09-25 12:46:36 +00:00
|
|
|
|
(progn
|
|
|
|
|
(message "No problems found")
|
|
|
|
|
nil)
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(message "The following options might have problems:")
|
2020-09-25 12:46:36 +00:00
|
|
|
|
(cus-test-message cus-test-errors)
|
|
|
|
|
cus-test-errors))
|
2002-10-10 22:50:35 +00:00
|
|
|
|
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(defun cus-test-deps ()
|
2002-10-10 22:50:35 +00:00
|
|
|
|
"Run a verbose version of `custom-load-symbol' on all atoms.
|
|
|
|
|
This function is suitable for batch mode. E.g., invoke
|
|
|
|
|
|
|
|
|
|
src/emacs -batch -l admin/cus-test.el -f cus-test-deps
|
|
|
|
|
|
2002-10-16 04:41:59 +00:00
|
|
|
|
in the Emacs source directory."
|
2002-10-10 22:50:35 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(setq cus-test-deps-errors nil)
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(setq cus-test-deps-required nil)
|
2002-10-10 23:25:11 +00:00
|
|
|
|
(setq cus-test-deps-loaded nil)
|
2002-10-10 22:50:35 +00:00
|
|
|
|
(mapatoms
|
|
|
|
|
;; This code is mainly from `custom-load-symbol'.
|
|
|
|
|
(lambda (symbol)
|
2002-10-16 04:41:59 +00:00
|
|
|
|
(let ((custom-load-recursion t))
|
|
|
|
|
(dolist (load (get symbol 'custom-loads))
|
|
|
|
|
(cond
|
|
|
|
|
((symbolp load)
|
|
|
|
|
;; (condition-case nil (require load) (error nil))
|
|
|
|
|
(condition-case alpha
|
2013-05-09 06:09:39 +00:00
|
|
|
|
(unless (or (featurep load)
|
|
|
|
|
(and noninteractive (eq load 'dunnet)))
|
2002-10-16 04:41:59 +00:00
|
|
|
|
(require load)
|
|
|
|
|
(push (list symbol load) cus-test-deps-required))
|
|
|
|
|
(error
|
|
|
|
|
(push (list symbol load alpha) cus-test-deps-errors)
|
|
|
|
|
(message "Require problem: %s %s %s" symbol load alpha))))
|
|
|
|
|
((equal load "loaddefs")
|
|
|
|
|
(push
|
|
|
|
|
(message "Symbol %s has loaddefs as custom dependency" symbol)
|
|
|
|
|
cus-test-deps-errors))
|
|
|
|
|
;; This is subsumed by the test below, but it's much
|
|
|
|
|
;; faster.
|
|
|
|
|
((assoc load load-history))
|
|
|
|
|
;; This was just
|
|
|
|
|
;; (assoc (locate-library load) load-history)
|
|
|
|
|
;; but has been optimized not to load locate-library
|
|
|
|
|
;; if not necessary.
|
|
|
|
|
((let ((regexp (concat "\\(\\`\\|/\\)" (regexp-quote load)
|
|
|
|
|
"\\(\\'\\|\\.\\)"))
|
|
|
|
|
(found nil))
|
|
|
|
|
(dolist (loaded load-history)
|
|
|
|
|
(and (stringp (car loaded))
|
|
|
|
|
(string-match regexp (car loaded))
|
|
|
|
|
(setq found t)))
|
|
|
|
|
found))
|
|
|
|
|
;; Without this, we would load cus-edit recursively.
|
|
|
|
|
;; We are still loading it when we call this,
|
|
|
|
|
;; and it is not in load-history yet.
|
|
|
|
|
((equal load "cus-edit"))
|
|
|
|
|
;; This would ignore load problems with files in
|
|
|
|
|
;; lisp/term/
|
|
|
|
|
;; ((locate-library (concat term-file-prefix load)))
|
|
|
|
|
(t
|
|
|
|
|
;; (condition-case nil (load load) (error nil))
|
|
|
|
|
(condition-case alpha
|
|
|
|
|
(progn
|
|
|
|
|
(load load)
|
|
|
|
|
(push (list symbol load) cus-test-deps-loaded))
|
|
|
|
|
(error
|
|
|
|
|
(push (list symbol load alpha) cus-test-deps-errors)
|
|
|
|
|
(message "Load Problem: %s %s %s" symbol load alpha))))
|
|
|
|
|
)))))
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(message "%s features required"
|
|
|
|
|
(length cus-test-deps-required))
|
|
|
|
|
(message "%s files loaded"
|
2002-10-10 23:25:11 +00:00
|
|
|
|
(length cus-test-deps-loaded))
|
2002-10-13 02:47:54 +00:00
|
|
|
|
(if (not cus-test-deps-errors)
|
|
|
|
|
(message "No load problems encountered")
|
|
|
|
|
(message "The following load problems appeared:")
|
|
|
|
|
(cus-test-message cus-test-deps-errors))
|
2002-10-10 22:50:35 +00:00
|
|
|
|
(run-hooks 'cus-test-after-load-libs-hook))
|
|
|
|
|
|
2013-05-10 07:31:34 +00:00
|
|
|
|
(defun cus-test-libs (&optional more)
|
2002-10-13 02:47:54 +00:00
|
|
|
|
"Load the libraries with autoloads in separate processes.
|
2002-10-10 22:50:35 +00:00
|
|
|
|
This function is useful to detect load problems of libraries.
|
|
|
|
|
It is suitable for batch mode. E.g., invoke
|
|
|
|
|
|
2013-05-09 06:09:39 +00:00
|
|
|
|
./src/emacs -batch -l admin/cus-test.el -f cus-test-libs
|
2002-10-10 22:50:35 +00:00
|
|
|
|
|
2013-05-10 07:31:34 +00:00
|
|
|
|
in the Emacs source directory.
|
|
|
|
|
|
|
|
|
|
If optional argument MORE is \"defcustom\", load all files with defcustoms.
|
|
|
|
|
If it is \"all\", load all Lisp files."
|
2002-10-08 18:42:36 +00:00
|
|
|
|
(interactive)
|
2013-05-10 07:31:34 +00:00
|
|
|
|
(and noninteractive
|
|
|
|
|
command-line-args-left
|
|
|
|
|
(setq more (pop command-line-args-left)))
|
2013-05-09 06:09:39 +00:00
|
|
|
|
(cus-test-load-1
|
2013-05-14 02:12:19 +00:00
|
|
|
|
(let* ((default-directory source-directory)
|
|
|
|
|
(emacs (expand-file-name "src/emacs"))
|
|
|
|
|
skipped)
|
2013-05-09 06:09:39 +00:00
|
|
|
|
(or (file-executable-p emacs)
|
2013-05-14 02:12:19 +00:00
|
|
|
|
(error "No such executable `%s'" emacs))
|
2013-05-09 06:09:39 +00:00
|
|
|
|
(mapc
|
|
|
|
|
(lambda (file)
|
|
|
|
|
(if (member file cus-test-libs-noloads)
|
|
|
|
|
(push file skipped)
|
|
|
|
|
(condition-case alpha
|
|
|
|
|
(let* ((fn (expand-file-name file "lisp/"))
|
|
|
|
|
(elc (concat fn "c"))
|
|
|
|
|
status)
|
|
|
|
|
(if (file-readable-p elc) ; load compiled if present (faster)
|
|
|
|
|
(setq fn elc)
|
|
|
|
|
(or (file-readable-p fn)
|
|
|
|
|
(error "Library %s not found" file)))
|
|
|
|
|
(if (equal 0 (setq status (call-process emacs nil nil nil
|
|
|
|
|
"-batch" "-l" fn)))
|
|
|
|
|
(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)))))
|
2013-05-10 07:31:34 +00:00
|
|
|
|
(if more
|
|
|
|
|
(cus-test-get-lisp-files (equal more "all"))
|
|
|
|
|
(cus-test-get-autoload-deps)))
|
2013-05-09 06:09:39 +00:00
|
|
|
|
(message "Default directory: %s" default-directory)
|
|
|
|
|
(when skipped
|
|
|
|
|
(message "The following libraries were skipped:")
|
|
|
|
|
(cus-test-message skipped)))))
|
2002-10-08 18:42:36 +00:00
|
|
|
|
|
2002-10-16 04:41:59 +00:00
|
|
|
|
(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)
|
2013-05-16 00:20:34 +00:00
|
|
|
|
(let ((groups-loaded (cus-test-get-options "" 'cus-load))
|
|
|
|
|
cus-loaded groups-not-loaded)
|
2002-10-16 04:41:59 +00:00
|
|
|
|
|
|
|
|
|
(message "Running %s" 'cus-test-load-custom-loads)
|
|
|
|
|
(cus-test-load-custom-loads)
|
2013-05-16 00:20:34 +00:00
|
|
|
|
(setq cus-loaded (cus-test-get-options ""))
|
2002-10-16 04:41:59 +00:00
|
|
|
|
|
|
|
|
|
(message "Running %s" 'cus-test-load-libs)
|
2013-05-14 02:12:19 +00:00
|
|
|
|
(cus-test-load-libs "all")
|
2013-05-16 00:20:34 +00:00
|
|
|
|
(setq cus-test-vars-not-cus-loaded (cus-test-get-options "")
|
|
|
|
|
groups-not-loaded (cus-test-get-options "" t))
|
2002-10-16 04:41:59 +00:00
|
|
|
|
|
|
|
|
|
(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
|
2021-01-31 23:00:39 +00:00
|
|
|
|
(sort cus-test-vars-not-cus-loaded #'string<)))
|
2013-05-16 00:20:34 +00:00
|
|
|
|
|
|
|
|
|
(dolist (o groups-loaded)
|
|
|
|
|
(setq groups-not-loaded (delete o groups-not-loaded)))
|
|
|
|
|
|
|
|
|
|
(if (not groups-not-loaded)
|
|
|
|
|
(message "No groups not in cus-load.el found")
|
|
|
|
|
(message "The following groups are not in cus-load.el:")
|
2021-01-31 23:00:39 +00:00
|
|
|
|
(cus-test-message (sort groups-not-loaded #'string<)))))
|
2002-10-16 04:41:59 +00:00
|
|
|
|
|
2002-10-08 18:42:36 +00:00
|
|
|
|
(provide 'cus-test)
|
|
|
|
|
|
|
|
|
|
;;; cus-test.el ends here
|