1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-12 09:28:11 +00:00

org-element--parse-to: Simplify code

This commit is contained in:
Ihor Radchenko 2022-02-05 19:08:39 +08:00
parent 1f78ca45f8
commit e29fea256d
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B

View File

@ -6475,18 +6475,17 @@ If you observe Emacs hangs frequently, please report this to Org mode mailing li
;; may exist though. Parse starting from the
;; last sibling or from ELEM-END if there are
;; no other siblings.
(let ((p (point)))
(goto-char pos)
(unless
(re-search-backward
(rx-to-string
`(and bol (repeat ,(let ((level (org-element-property :level element)))
(if org-odd-levels-only (1- (* level 2)) level))
"*")
" "))
elem-end t)
;; Roll-back to normal parsing.
(goto-char p))))))
(goto-char pos)
(unless
(re-search-backward
(rx-to-string
`(and bol (repeat ,(let ((level (org-element-property :level element)))
(if org-odd-levels-only (1- (* level 2)) level))
"*")
" "))
elem-end t)
;; Roll-back to normal parsing.
(goto-char elem-end)))))
(setq mode (org-element--next-mode mode type nil)))
;; A non-greater element contains point: return it.
((not (memq type org-element-greater-elements))