> On Dec 12, 2023, at 21:01, Aaron Madlon-Kay <aa...@madlon-kay.com> wrote: > >> On Dec 12, 2023, at 20:40, Aaron Madlon-Kay <aa...@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