lisp/org-element-ast.el (org-element-type-p): Simplify implementation

Reported-by: Stefan Monnier <monnier@iro.umontreal.ca>
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68818#11
This commit is contained in:
Ihor Radchenko 2024-01-30 17:19:05 +01:00
parent 86c4038da6
commit afc529b4a0
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 5 additions and 10 deletions

View File

@ -230,16 +230,11 @@ when NODE is an anonymous node."
(define-inline org-element-type-p (node types)
"Return non-nil when NODE type is one of TYPES.
TYPES can be a type symbol or a list of symbols."
(if (inline-const-p types)
(if (listp (inline-const-val types))
(inline-quote (memq (org-element-type ,node t) ,types))
(inline-quote (eq (org-element-type ,node t) ,types)))
(inline-letevals (node types)
(inline-quote
(if (listp ,types)
(memq (org-element-type ,node t) ,types)
(eq (org-element-type ,node t) ,types))))))
TYPES can be a type symbol or a list of symbols."
(inline-letevals (node types)
(if (listp (inline-const-val types))
(inline-quote (memq (org-element-type ,node t) ,types))
(inline-quote (eq (org-element-type ,node t) ,types)))))
(defun org-element-secondary-p (node)
"Non-nil when NODE directly belongs to a secondary node.