emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: get the body of a heading up to the next subheading


From: Eric Abrahamsen
Subject: Re: get the body of a heading up to the next subheading
Date: Wed, 13 May 2020 09:08:01 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

John Kitchin <address@hidden> writes:

> Thanks! Here is what I am currently using:
>
> (defun canvas-org-get-heading-body ()
>   "Return the body of the current heading up to the next heading."
>   (interactive)
>   (save-excursion
>     (unless (org-at-heading-p)
>       (org-previous-visible-heading 1))
>     (org-end-of-meta-data)
>     (buffer-substring (point)
>                     (progn (re-search-forward org-heading-regexp nil 'mv)
>                            (line-beginning-position)))))
>
> So far it gets what I want. I am pretty sure I have reinvented this,
> maybe even from code I wrote before... I couldn't find my answer on SO
> or my blog though.

I don't think there's anything built-in, no. I have needed this in
various places, and did something similar to the above, except with a
combination of `org-back-to-heading', `org-end-of-meta-data', then
`outline-next-heading'. 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]