all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
	kyle@kyleam.com, emacs-devel@gnu.org
Subject: Re: master 5a125fb5a97 1/2: Update to Org 9.7.3
Date: Thu, 13 Jun 2024 13:00:58 +0000	[thread overview]
Message-ID: <878qz9gfp1.fsf@localhost> (raw)
In-Reply-To: <8634pj7jni.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> (defcustom org-num-skip-tags nil
> ...
>>   :safe (lambda (val) (and (listp val) (cl-every #'stringp val))))
>> 
>> Note that org-num.el where `org-num-skip-tags' is defined does have
>> (require 'cl-lib).
>> 
>> IMHO, there is some problem either with loaddefs generation or with the
>> fact that loaddefs file is compiled at all.
>
> No, the problem is that this variable uses cl-lib stuff for safep
> functions.  IMO, this is not a good idea, and the above situation is
> precisely the evidence for that.
>
>> Of course, we can always convert that lambda into a proper function,
>> which will likely get rid of the warning.
>
> Yes, please.  Emacs 28 and later has list-of-strings-p, but if you
> want to support older versions of Emacs, perhaps that's not usable.
> Or maybe we could add that to compat.el.

Org cannot directly use compat.el for now.
I am attaching tentative patch that defines a compatibility alias and
autoloads it.
Is this approach good enough?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-num-skip-tags-Avoid-using-function-that-is-not-p.patch --]
[-- Type: text/x-patch, Size: 2062 bytes --]

From e70b7ce648aa54d5c6a3c91a2fd9982cd0a6e790 Mon Sep 17 00:00:00 2001
Message-ID: <e70b7ce648aa54d5c6a3c91a2fd9982cd0a6e790.1718283515.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
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 <eliz@gnu.org>
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)))
+
 \f
 ;;; 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


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

  parent reply	other threads:[~2024-06-13 13:00 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <171796793548.23337.12512115872160390161@vcs2.savannah.gnu.org>
     [not found] ` <20240609211858.A2C31C1F9FB@vcs2.savannah.gnu.org>
2024-06-10  0:40   ` master 5a125fb5a97 1/2: Update to Org 9.7.3 Po Lu
2024-06-10  1:14     ` Kyle Meyer
2024-06-10  3:45       ` Po Lu
2024-06-10  3:58         ` Po Lu
2024-06-12 13:08         ` Ihor Radchenko
2024-06-12 13:13           ` Eli Zaretskii
2024-06-12 13:23             ` Ihor Radchenko
2024-06-12 13:30               ` Eli Zaretskii
2024-06-14 13:18                 ` Ihor Radchenko
2024-06-10 11:13       ` Eli Zaretskii
2024-06-11 10:05         ` Ihor Radchenko
2024-06-11 12:23           ` Eli Zaretskii
2024-06-11 13:10             ` Robert Pluim
2024-06-14  9:49               ` Ihor Radchenko
2024-06-14 11:39                 ` Eli Zaretskii
2024-06-14 12:02                   ` Robert Pluim
2024-06-11 13:16             ` Stefan Monnier
2024-06-12 13:49               ` Ihor Radchenko
2024-06-12 14:41                 ` Stefan Monnier
2024-06-13 13:00             ` Ihor Radchenko [this message]
2024-06-13 13:43               ` Eli Zaretskii
2024-06-13 14:34                 ` Stefan Monnier
2024-06-14 12:39                 ` Ihor Radchenko
2024-06-13 13:32             ` Ihor Radchenko
2024-06-13 13:54               ` Eli Zaretskii
2024-06-15 11:20                 ` Ihor Radchenko
2024-06-15 12:46                   ` Eli Zaretskii
2024-06-15 12:55                     ` Syncing Org bugfix releases with emacs-30 branch (was: master 5a125fb5a97 1/2: Update to Org 9.7.3) Ihor Radchenko
2024-06-15 13:02                       ` Eli Zaretskii
2024-06-16 11:09                         ` Ihor Radchenko
2024-06-15 16:58                     ` master 5a125fb5a97 1/2: Update to Org 9.7.3 Kyle Meyer
2024-06-11 11:03   ` Stefan Kangas
2024-06-12  3:45     ` Kyle Meyer
2024-06-12  8:52       ` Eli Zaretskii
2024-06-12 12:58         ` Ihor Radchenko
2024-06-12 13:02           ` Eli Zaretskii
2024-06-12 13:21             ` Ihor Radchenko
2024-06-12 13:29               ` Eli Zaretskii
2024-06-12 14:14                 ` Stefan Kangas
2024-06-13 16:12                   ` Ihor Radchenko
2024-06-13 16:48                     ` Eli Zaretskii
2024-06-12 14:46             ` Stefan Monnier
2024-06-12 16:50               ` Eli Zaretskii
2024-06-13 15:44                 ` Ihor Radchenko
2024-06-13 15:55                   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878qz9gfp1.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=kyle@kyleam.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.