emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[BUG] "Safe" local values for org-entities-user not recognized as such


From: Aaron Madlon-Kay
Subject: [BUG] "Safe" local values for org-entities-user not recognized as such [9.6.11 (release_9.6.11 @ /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/org/)]
Date: Tue, 12 Dec 2023 20:40:58 +0900

Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------

Local definitions for `org-entities-user` are not recognized as "safe"
even when they are in the correct format. For instance, including the
following local variables list in an org-mode file will still result in
Emacs prompting you to accept the value:

# Local Variables:
# org-entities-user: (("snowman" "[snowman]" nil "☃" "[snowman]" 
"[snowman]" "☃"))
# End:

Cause: The defcustom for `org-entities-user` has :safe set to the
function `org-entities--user-safe-p`. This function, however, appears to
be designed to validate a single entry of `org-entities-user`, rather
than the full value. Locally redefining as follows results in the
expected behavior:

(defun org-entities--user-safe-p (v)
  "Non-nil if V is a safe value for `org-entities-user'."
  (seq-every-p
   (lambda (e) (pcase e
            (`nil t)
            (`(,(and (pred stringp)
                         (pred (string-match-p "\\`[a-zA-Z][a-zA-Z0-9]*\\'")))
               ,(pred stringp) ,(pred booleanp) ,(pred stringp)
               ,(pred stringp) ,(pred stringp) ,(pred stringp))
             t)
            (_ nil)))
   v))

The difference is that the current logic has been supplied as a lambda
to `seq-every-p`.

Thank you,
Aaron

Emacs  : GNU Emacs 30.0.50 (build 1, x86_64-apple-darwin23.1.0, NS 
appkit-2487.20 Version 14.1.1 (Build 23B81))
of 2023-11-26
Package: Org mode version 9.6.11 (release_9.6.11 @ 
/Applications/MacPorts/Emacs.app/Contents/Resources/lisp/org/)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]