Skip to content

Instantly share code, notes, and snippets.

@gahag
Created May 27, 2020 16:56
Show Gist options
  • Save gahag/603fb1c9dabc8e7a29836af18fb94597 to your computer and use it in GitHub Desktop.
Save gahag/603fb1c9dabc8e7a29836af18fb94597 to your computer and use it in GitHub Desktop.
(defun org-refile-to (headline)
"Move current subtree to specified headline"
(org-refile nil
nil
(list headline
(buffer-file-name)
nil
(org-find-exact-headline-in-buffer (capitalize headline)))))
(defun org-refile-todo ()
"Move current subtree to the corresponding todo heading"
(interactive)
(when (and (eq (org-current-level) 2)
(not (member "pin" (org-get-tags))))
(org-refile-to (org-get-todo-state))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment