0

When we refile, the refiled stuff goes to the end of the heading under which it is being refiled.

Can we get the refiled stuff to go to the top, instead?

This can be easily done while capturing. I can write a custom template and with :prepend t instruction, the captured stuff goes to the top of the heading under which it is getting captured.

2 Answers 2

1

The doc string of org-refile says:

At the target location, the entry is filed as a subitem of the target heading. Depending on ‘org-reverse-note-order’, the new subitem will either be the first or the last subitem.

If you don't want to set it permanently, you can let-bind it in your own org-refile wrapper command:

(defun my/org-refile ()
  (interactive)
  (let ((org-reverse-note-order t))
    (call-interactively #'org-refile)))
1
  • Thanks. Especially, the function to set it up temporarily will be very useful.
    – deshmukh
    Apr 17, 2021 at 15:41
0

If you want org-capture-refile (C-c C-w) to respect :prepend from the org-capture-templates definition, one option, and the one that worked best for me, was to create an advice like the following:

    (defun my/org--capture-refile (orig-fun &rest args)
      (let ((org-reverse-note-order (org-capture-get :prepend 'local)))
        (apply orig-fun args)))

    (advice-add #'org-capture-refile :around 'my/org--capture-refile)

This way, org-reverse-note-order is temporarily overridden based on :prepend from the template.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.