emacs-orgmode
[Top][All Lists]
Advanced

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

[O] kill contents of a headline, but retain properties


From: Matt Price
Subject: [O] kill contents of a headline, but retain properties
Date: Fri, 7 Aug 2015 08:44:16 -0400

Hi,

I have a headline like this:

* Gradebook
:PROPERTIES:
:CUSTOM_ID: gradebook
:END:

some content etc etc etc.

I would like to be able to replace the contents of that headline automatically, but retain the properties.  Howeve,r if for some reason the properites drawer is there I don't want to accidentally search to the NEXT headline and replace ITS content! -- so I don't want to just re-search-forward ":END:".  I tried this:

(org-open-link-from-string "[[#gradebook]]")
(kill-region (org-element-property :contents-begin (org-element-at-point)) (org-element-property :contents-end (org-element-at-point)))

But "contents-begin" of course starts at the beginning of the property drawer.  I thought "org-element-contents" might help me but it doesn't.

Any suggestions? Thank you!
matt

reply via email to

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