Skip to content

Instantly share code, notes, and snippets.

@commander-trashdin
Created May 18, 2020 01:08
Show Gist options
  • Save commander-trashdin/c193491ab2f12f23685ea0353f6523ca to your computer and use it in GitHub Desktop.
Save commander-trashdin/c193491ab2f12f23685ea0353f6523ca to your computer and use it in GitHub Desktop.
I'm just trying to help
(defun tt-heading-description ()
"Get header and description of first header element in buffer."
(with-temp-buffer
(insert "
* Top Heading
Some description
* Second Heading
Other description
")
(let ((first-headline (seq-find (lambda (part) (eql (car part) 'headline)) (org-element-parse-buffer))))
(let ((contents-begin (org-element-property :contents-begin first-headline))
(contents-end (org-element-property :contents-end first-headline)))
(list
(org-element-property :raw-value first-headline)
(buffer-substring contents-begin (- contents-end 1)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment