takeonrules · 2022-03-17 20:43
Let's say I have the following org document
:PROPERTIES:
:ID: 7D911AF0-5179-434D-87CE-2D3F150A082D
:AUTHOR: takeonrules
:WORK_URL: https://takeonrules.com/
:END:
#+title: Discard this Node
#+FILETAGS:
lorem ipsum /dolorum/
dunning kruger
How can I extract just the content (e.g. "lore ipsom /dolorum/...")? That is I don't want `:PROPERTIES:` nor the `#+title` nor any other `#+` properties.
[deleted] · 2022-03-17 21:29
[deleted]
whudwl · 2022-03-17 21:42
Check out https://github.com/alphapapa/unpackaged.el
Function `(unpackaged/org-agenda-toggle-preview)` shows an item's body in an overlay when called from agenda buffer. You can use it as a basis to create your own function.
takeonrules · 2022-03-17 22:08
Reading that, it looks like it finds the first position by eliminating all of the not paragraph stuff, converting that to a substring and finally having `org-agenda-with-point-at-orig-entry` evaluate it to create the contents.
I think I can perhaps move forward with this. It was far more complicated than I would've thought.
takeonrules · 2022-03-17 22:15
The following gets me what I need. Thank you.
(defun jf/org-mode-extract-keyword-and-node-properties (node-id)
(with-current-buffer (find-file-noselect (org-id-find-id-file node-id))
(buffer-substring (save-excursion
(unpackaged/org-forward-to-entry-content t)
(point))
(org-entry-end-position))))
whudwl · 2022-03-17 22:38
Glad to help.
nv-elisp · 2022-03-18 04:30
Take a look at the example here:
https://orgmode.org/worg/dev/org-element-api.html#accessors