Function: avy-org-refile-as-child
avy-org-refile-as-child is an interactive and byte-compiled function
defined in avy.el.
Signature
(avy-org-refile-as-child)
Documentation
Refile current heading as first child of heading selected with avy.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/avy-20241101.1357/avy.el
(defun avy-org-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)
(marker (save-excursion
(avy-with avy-goto-line
(unless (eq 't (avy-jump (rx bol (1+ "*") (1+ space))))
;; `avy-jump' returns t when aborted with C-g.
(point-marker)))))
(filename (buffer-file-name (or (buffer-base-buffer (marker-buffer marker))
(marker-buffer marker))))
(rfloc (list nil filename nil marker))
;; Ensure the refiled heading is visible.
(org-after-refile-insert-hook (if (member 'org-reveal org-after-refile-insert-hook)
org-after-refile-insert-hook
(cons #'org-reveal org-after-refile-insert-hook))))
(when marker
;; Only attempt refile if avy session was not aborted.
(org-refile nil nil rfloc))))