Revert "lisp/org-element-ast.el (org-element-property-raw): Simplify implementation"

This reverts commit cfb48624f3.

The commit is not compatible with Emacs 27, which is still supported.
This commit is contained in:
Ihor Radchenko 2024-02-10 16:39:13 +01:00
parent 80e7c9f80f
commit 942b4d97c1
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 20 additions and 10 deletions

View File

@ -405,16 +405,26 @@ Ignore standard property array."
Do not resolve deferred values.
If PROPERTY is not present, return DFLT."
(declare (pure t))
(inline-letevals (node property)
(let ((idx (org-element--property-idx (inline-const-val property))))
(inline-quote
(let ((idx (or ,idx (org-element--property-idx ,property))))
(if-let ((parray (and idx (org-element--parray ,node))))
(pcase (aref parray idx)
(`org-element-ast--nil ,dflt)
(val val))
;; No property array exists. Fall back to `plist-get'.
(org-element--plist-property ,property ,node ,dflt)))))))
(let ((idx (and (inline-const-p property)
(org-element--property-idx property))))
(if idx
(inline-letevals (node)
(inline-quote
(if-let ((parray (org-element--parray ,node)))
(pcase (aref parray ,idx)
(`org-element-ast--nil ,dflt)
(val val))
;; No property array exists. Fall back to `plist-get'.
(org-element--plist-property ,property ,node ,dflt))))
(inline-letevals (node property)
(inline-quote
(let ((idx (org-element--property-idx ,property)))
(if-let ((parray (and idx (org-element--parray ,node))))
(pcase (aref parray idx)
(`org-element-ast--nil ,dflt)
(val val))
;; No property array exists. Fall back to `plist-get'.
(org-element--plist-property ,property ,node ,dflt))))))))
(define-inline org-element--put-parray (node &optional parray)
"Initialize standard property array in NODE.