org-avy-refile-as-child: Refile Org heading as child of heading selected with Avy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun ap/org-avy-refile-as-child () | |
"Refile current heading as first child of heading selected with `avy.'" | |
;; Inspired by `org-teleport': http://kitchingroup.cheme.cmu.edu/blog/2016/03/18/Org-teleport-headlines/ | |
(interactive) | |
(let* ((org-reverse-note-order t) | |
(pos (save-excursion | |
(avy-with avy-goto-line (avy--generic-jump (rx bol "*") nil avy-style)) | |
(point))) | |
(filename (buffer-file-name (or (buffer-base-buffer (current-buffer)) | |
(current-buffer)))) | |
(rfloc (list nil filename nil pos))) | |
(org-refile nil nil rfloc))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment