diff --git a/lisp/org-element-ast.el b/lisp/org-element-ast.el index 13635679a..6a3ae5e43 100644 --- a/lisp/org-element-ast.el +++ b/lisp/org-element-ast.el @@ -226,6 +226,19 @@ when NODE is an anonymous node." 'anonymous) (t nil))) +(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)))))) + (defun org-element-secondary-p (node) "Non-nil when NODE directly belongs to a secondary node. Return value is the containing property name, as a keyword, or nil."