On 2025-07-12, at 18:59, Ihor Radchenko <yanta...@posteo.net> wrote:

> mb...@mbork.pl writes:
>
>> 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))))
>>      ...)
>
> Try `org-complex-heading-regexp'.

Thanks, this would probably work - I could match it and then get the
positions.  Is it "better" than my approach?  I mean, are there any
obvious pros and cons of both?

Thanks,

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

Reply via email to