From e70b7ce648aa54d5c6a3c91a2fd9982cd0a6e790 Mon Sep 17 00:00:00 2001 Message-ID: From: Ihor Radchenko Date: Thu, 13 Jun 2024 14:53:03 +0200 Subject: [PATCH] org-num-skip-tags: Avoid using function that is not pre-loaded in autoloads * lisp/org-num.el (org-num-skip-tags): Make sure that function used for :safe `defcustom' slot does not require functions that are not defined in org-loaddefs.el. This is because `org-num-skip-tags' is autoloaded and cannot rely upon requires in org-num.el. Instead, it may only use pre-loaded functions and other autoloaded Org mode functions. Reported-by: Eli Zaretskii Link: https://yhetil.org/emacs-devel/868qzd9hjg.fsf@gnu.org/ --- lisp/org-compat.el | 11 +++++++++++ lisp/org-num.el | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index d6620f962..41c26ad72 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -251,6 +251,17 @@ (defun org-format-prompt (prompt default &rest format-args) default))) ": "))) +(if (fboundp 'list-of-strings-p) + (defalias 'org-list-of-strings-p #'list-of-strings-p) + ;; From Emacs subr.el. +;;;###autoload + (defun org-list-of-strings-p (object) + "Return t if OBJECT is nil or a list of strings." + (declare (pure t) (side-effect-free error-free)) + (while (and (consp object) (stringp (car object))) + (setq object (cdr object))) + (null object))) + ;;; Emacs < 27.1 compatibility diff --git a/lisp/org-num.el b/lisp/org-num.el index aebfef050..a8fcf3333 100644 --- a/lisp/org-num.el +++ b/lisp/org-num.el @@ -144,7 +144,7 @@ (defcustom org-num-skip-tags nil :group 'org-appearance :package-version '(Org . "9.3") :type '(repeat (string :tag "Tag")) - :safe (lambda (val) (and (listp val) (cl-every #'stringp val)))) + :safe #'org-list-of-strings-p) ;;;###autoload (defcustom org-num-skip-unnumbered nil -- 2.45.1