mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-25 07:27:57 +00:00
org-entities: Tiny refactoring
* lisp/org-entities.el (org-entities--user-safe-p): Use pattern matching and strengthen check for name.
This commit is contained in:
parent
27c5cf153f
commit
c69fd5bf61
@ -37,16 +37,14 @@
|
||||
|
||||
(defun org-entities--user-safe-p (v)
|
||||
"Non-nil if V is a safe value for `org-entities-user'."
|
||||
(or (null v)
|
||||
(and (listp v)
|
||||
(= (length v) 7)
|
||||
(stringp (nth 0 v))
|
||||
(stringp (nth 1 v))
|
||||
(booleanp (nth 2 v))
|
||||
(stringp (nth 3 v))
|
||||
(stringp (nth 4 v))
|
||||
(stringp (nth 5 v))
|
||||
(stringp (nth 6 v)))))
|
||||
(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)))
|
||||
|
||||
(defcustom org-entities-user nil
|
||||
"User-defined entities used in Org-mode to produce special characters.
|
||||
|
Loading…
Reference in New Issue
Block a user