From: Aaron Madlon-Kay <aaron@madlon-kay.com>
To: 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 21:29:28 +0900 [thread overview]
Message-ID: <9F699FA3-5FC1-4470-958C-05DD976B6096@madlon-kay.com> (raw)
In-Reply-To: <EC72E108-B2E7-47CC-BA30-18E8B3AAEE15@madlon-kay.com>
> On Dec 12, 2023, at 21:01, Aaron Madlon-Kay <aaron@madlon-kay.com> wrote:
>
>> On Dec 12, 2023, at 20:40, Aaron Madlon-Kay <aaron@madlon-kay.com> wrote:
>>
>> Locally redefining as follows results in the expected behavior:
>
> The previous formulation was not very good. Actually it seems that the existing
> function is correct except that the list case should be wrapped in (seq …).
OK this was also wrong, because seq only matches a finite sequence. I couldn’t
find a way to match an arbitrary-length list with pcase, so here’s my final
attempt:
(defun org-entities--user-safe-p (v)
"Non-nil if V is a safe value for `org-entities-user'."
(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))))
This seems to handle all cases correctly, but again of course I leave the
details to the devs (is seq-every-p allowed? is there actually a way to do it
with just pcase?).
Thanks,
Aaron
next prev parent reply other threads:[~2023-12-12 12:30 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 [this message]
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
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9F699FA3-5FC1-4470-958C-05DD976B6096@madlon-kay.com \
--to=aaron@madlon-kay.com \
--cc=emacs-orgmode@gnu.org \
/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.