Hi all,

with the point on a headline, I'd like to be able to get the positions
of the start and end of the current headline's title.  How to do that?
Here's what I have, is there a better way?

(This includes tags; I'm fine with that, though excluding them might be
better.)

--8<---------------cut here---------------start------------->8---
(let* ((elt (org-element-at-point))
       (begin (save-excursion
                (goto-char (org-element-property :begin elt))
                (when (looking-at org-element-headline-re)
                  (match-end 0))))
       (end (1- (org-element-property :contents-begin elt))))
     ...)
--8<---------------cut here---------------end--------------->8---

TIA,

-- 
Marcin Borkowski
https://mbork.pl
https://crimsonelevendelightpetrichor.net/

Reply via email to