Mike Gauland <mikely...@gmail.com> writes: > I'd like to be able to be able to get the text associated with a given > heading (based on the current point, for example). > > Can anyone point me to an example for doing this in the approved manner > (assuming there is one), or to functions to help with this?
Don't trust me to give you an approved manner, but a couple of options: * If you just care about headlines and assuming you want all associated content, including the headline text itself, perhaps calling org-copy-subtree non-interactively will suffice. If that doesn't behave how you want, looking at org-copy-subtree's source could still give you an idea of how to do what you want in elisp. * You could use the org-element API to get the information and likely could easily tweak something like below to suit your needs. (and (ignore-errors (org-back-to-heading t)) (let ((el (org-element-at-point))) (buffer-substring (org-element-property :begin el) (org-element-property :end el)))) -- Kyle