Emacs org-mode delete contents of a tree (or copy structure of tree without content) -


i trying make natural planning tree (following advices getting things done david allen) looks like:

* natural planning model  ** item 1 *** purpose , principles (why) *** outcome visioning *** brainstorming *** organizing *** identifying next actions  ** item 2... ** item 3... 

i copy outline structure of item 1 new items. problem have filled lot of information inside subtree item 1.

my general question is: there way delete contents of tree not it's headers (the rows start *)? similarly, there way copy structure of tree without it's contents?

i don't recall command in org, make own pretty easily.

(defun org-copy-subtree-headings-as-kill ()   "copy headings of current subtree kill."   (interactive)   (save-excursion     (org-back-to-heading)     (let* ((el (org-element-at-point))            (beg (org-element-property :begin el))            (end (org-element-property :end el))            (tree (buffer-substring-no-properties beg end)))       (with-temp-buffer         (insert tree)         (goto-char (point-min))         (while (not (eobp))           (if (looking-at-p "^\\*")               (forward-line)             (delete-region (point-at-bol) (1+ (point-at-eol)))))         (kill-new (buffer-string)))))) 

also, if these headings same set of headings, use yasnippet template.

to delete content current tree (instead of copying headings), narrow subtree , call keep-lines ^\*.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -