Babblings of an aging geek in love with the Absurd, his family, and his own hubris.... oh, and Lisp.

Auxillary Information for Essay

Cleaner File Creation

The function, org-refile-subtree-to-file-clean, is pretty simple as it overwrites anything in the new file buffer:

(defun org-refile-subtree-to-file-clean (region file header body tags)
  "Replace the current org-mode buffer with some sort of default
format with a title of HEADER and the contents of BODY. The TAGS
can be a list of strings that will be included."
  (apply 'delete-region region)
  (find-file-other-window file)
  (delete-region (point-min) (point-max))
  (insert "#+TITLE:  " header "\n"
          "#+AUTHOR: " user-full-name "\n"
          "#+EMAIL:  " user-mail-address "\n"
          "#+DATE:   " (format-time-string "%Y-%m-%d %A") "\n"
          (when tags (concat "#+TAGS:   " (s-join " " tags) "\n"))

The previous approach, however, can loose a lot of information, like any properties associated with subtree. Of course, a subtree’s properties, stored in a drawer, should be at the top of the file, eh?

Moving a Subtree to a File

Subtree Contents

I should also mention that a component can return two end symbols: :end and :contents-begin: