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: Ihor Radchenko
Subject: Re: get the body of a heading up to the next subheading
Date: Thu, 14 May 2020 00:41:21 +0800

> 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'. 

Hmm. I just noticed a reference to built-in
org-agenda-get-some-entry-text in the function I sent earlier.
I do not see why it cannot be used outside agenda. Maybe something like

(let ((org-agenda-entry-text-cleanup-hook nil))
(org-agenda-get-some-entry-text (point-marker) #x40000000))


Eric Abrahamsen <address@hidden> writes:

> 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'. 

-- 
Ihor Radchenko,
PhD,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong 
University, Xi'an, China
Email: address@hidden, address@hidden



reply via email to

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