Function: org-appear--parse-elem
org-appear--parse-elem is a natively compiled function defined in
org-appear.el.
Signature
(org-appear--parse-elem ELEM)
Documentation
Return bounds of element ELEM.
Return nil if element cannot be parsed.
Source Code
;; Defined in /nix/store/ysqmilmh80y85ik1crg29w7g7i73wjk9-emacs-packages-deps/share/emacs/site-lisp/elpa/org-appear-20260716.2120/org-appear.el
(defun org-appear--parse-elem (elem)
"Return bounds of element ELEM.
Return nil if element cannot be parsed."
(let* ((elem-type (car elem))
(elem-tag (cond ((memq elem-type '(bold
italic
underline
strike-through
verbatim
code))
'emph)
((memq elem-type '(subscript
superscript))
'script)
((eq elem-type 'entity)
'entity)
((eq elem-type 'link)
'link)
((eq elem-type 'keyword)
'keyword)
((memq elem-type '(latex-fragment latex-environment))
'latex-fragment)
(t nil)))
(elem-start (org-element-property :begin elem))
(elem-end (org-element-property :end elem))
(elem-content-start (org-element-property :contents-begin elem))
(elem-content-end (org-element-property :contents-end elem))
;; Some elements have extra spaces at the end
;; The number of spaces is stored in the post-blank property
(post-elem-spaces (org-element-property :post-blank elem))
(elem-end-real (- elem-end post-elem-spaces)))
;; Only sub/superscript elements are guaranteed to have
;; contents-begin and contents-end properties
(when elem-tag
`(:start ,elem-start
:end ,elem-end-real
:visible-start ,(pcase elem-tag
('emph (1+ elem-start))
('script elem-content-start)
('link (or elem-content-start (+ elem-start 2))))
:visible-end ,(pcase elem-tag
('emph (1- elem-end-real))
('script elem-content-end)
('link (or elem-content-end (- elem-end-real 2))))))))