There exist functions to set tags, keywords, and priority values (org-set-tags-to
, org-todo
, and org-priority
respectively), but what about setting the heading (item) itself?
For example:
*** TODO [#B] Some existing heading :URGENT:
(my/org-set-heading "The new heading")
*** TODO [#B] The new heading :URGENT:
Setting the heading is non-trivial; the logic needs to be mindful of outline folding, heading stars, the priority label, and tags-- at the very least. Is there an org function that accomplishes this (or a 3rd-party library that includes one)?
I haven't found any org functions that accomplish this, but my apropos-fu has certainly failed me before.
A fairly thorough search suggests that I'll need to employ org-complex-heading-regexp
, special care to the subtree/folding, and possibly a patch request.