org-babel-tangle-collect-blocks: Switch to org-element API

This commit is contained in:
Ihor Radchenko 2023-05-07 22:47:19 +02:00
parent ebbdd67a2a
commit 7c549f4841
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 5 additions and 8 deletions

View File

@ -458,14 +458,11 @@ code blocks by target file."
(let ((counter 0) last-heading-pos blocks)
(org-babel-map-src-blocks (buffer-file-name)
(let ((current-heading-pos
(if (org-element--cache-active-p)
(or (org-element-begin
(org-element-lineage
(org-element-at-point)
'headline t))
1)
(org-with-wide-buffer
(org-with-limited-levels (outline-previous-heading))))))
(or (org-element-begin
(org-element-lineage
(org-element-at-point)
'headline t))
1)))
(if (eq last-heading-pos current-heading-pos) (cl-incf counter)
(setq counter 1)
(setq last-heading-pos current-heading-pos)))