Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • (1) Please say how the code you've written doesn't do what you want. It's not clear what you do want. (2) For region-beginning and region-end to do what you want, you need to select that text as the region - set mark and point at the beginning and end, for instance. (3) Can you do what you want with a keyboard macro, i.e., interactively, recording your keystrokes? If so, provide those keystrokes/actions, as a recipe to show what you want done. Commented Dec 28, 2021 at 22:53
  • @Drew: org-mark-subtree does set the region but it marks the whole subtree (from the headline ** Answer to the end of the buffer or the beginning of the next subtree at the same or higher level (whichever is encountered first). So the region includes the headline (** Answer) and the properties drawer (and possibly more things like scheduling information), both (all?) of which the OP wants to exclude from the count. Commented Dec 28, 2021 at 23:30
  • @NickD: That's why I wrote "...what you want, you need to select that text". I meant select (only) the text you want to act on. Commented Dec 29, 2021 at 2:19
  • 1
    I wrote up my own super complex regexp a few years ago to extract what I call the notes section of the subtree, which is the area @mon seeks to extract. However, my custom regexp is rather brittle, relying upon certain components that will always exist in the formation of the subtree ... Perhaps the O.P. can move to the end of the subtree and then extract the data between the end of org-property-end-re and subtree end. Commented Dec 29, 2021 at 4:44
  • 1
    Another idea to consider ... the org-agenda.el library has a mechanism to display the notes section of the subtree (with a toggle function) .... Perhaps the O.P. could use a similar mechanism to programmatically isolate and extract the data from said notes section. Commented Dec 29, 2021 at 4:51