emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Aaron Madlon-Kay <aaron@madlon-kay.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [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 23:36:47 +0900	[thread overview]
Message-ID: <383539A4-8599-498E-8FEF-665B74A2AD08@madlon-kay.com> (raw)
In-Reply-To: <87y1dz5wxm.fsf@localhost>

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

> On Dec 12, 2023, at 23:15, Ihor Radchenko <yantar92@posteo.net> wrote:
> 
> This particular change should fit within TINYCHANGE, I think. So, you do
> not need a copyright assignment (unless you have already exhausted the
> 15LOC limit on Emacs patches, which I do not see in git logs).

Ah, yes, that should be OK then. Please see attached.

Thanks,
Aaron


[-- Attachment #2: 0001-lisp-org-entities.el-Fix-safe-value-predicate-for-or.patch --]
[-- Type: application/octet-stream, Size: 1669 bytes --]

From 0716d90fe9a19fb668fd0fc6890adc565205f8d5 Mon Sep 17 00:00:00 2001
From: Aaron Madlon-Kay <aaron@madlon-kay.com>
Date: Tue, 12 Dec 2023 23:21:22 +0900
Subject: [PATCH] lisp/org-entities.el: Fix safe value predicate for
 org-entities-user

* lisp/org-entities.el (org-entities--user-safe-p): Fix logic to
validate a list of entries, rather than a single entry.

Reported-by: "Aaron Madlon-Kay" <aaron@madlon-kay.com>
Link: https://list.orgmode.org/874jgn7f7s.fsf@localhost/

TINYCHANGE
---
 lisp/org-entities.el | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/lisp/org-entities.el b/lisp/org-entities.el
index 91c17f4d6..87d2fbe67 100644
--- a/lisp/org-entities.el
+++ b/lisp/org-entities.el
@@ -41,14 +41,19 @@ defgroup org-entities
 
 (defun org-entities--user-safe-p (v)
   "Non-nil if V is a safe value for `org-entities-user'."
-  (pcase v
-    (`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)))
+  (cond
+   ((not v) t)
+   ((listp v)
+    (seq-every-p
+     (lambda (e)
+       (pcase e
+         (`(,(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))))
 
 (defcustom org-entities-user nil
   "User-defined entities used in Org to produce special characters.
-- 
2.43.0


  parent reply	other threads:[~2023-12-12 14:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12 11:40 [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/)] Aaron Madlon-Kay
2023-12-12 12:01 ` Aaron Madlon-Kay
2023-12-12 12:29   ` Aaron Madlon-Kay
2023-12-12 12:55     ` Ihor Radchenko
     [not found]       ` <98E48EEB-5E10-42ED-91D4-9369B6B98B20@madlon-kay.com>
     [not found]         ` <87y1dz5wxm.fsf@localhost>
2023-12-12 14:36           ` Aaron Madlon-Kay [this message]
2023-12-12 15:18             ` Ihor Radchenko

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=383539A4-8599-498E-8FEF-665B74A2AD08@madlon-kay.com \
    --to=aaron@madlon-kay.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).