Refile and Copy

In Org Mode one can refile or copy subtrees to different lists. This makes cutting/copying information across org files easier.

:Tip: One can also use this method to JUMP to various headings.

Refile This Heading

The Chief command is

C-c C-w (org-refile)

With a prefix argument "jump" rather than "move".
With two prefix arguments, jump to the location of last refile.

My settings

I prefer to move headings from one org-agenda file to another rather than to within headings of the same buffer. The code below does this. Headings are moved from one org-agenda file to another and place at the top of the file. This allows me to better organize my org-agenda files, because I prefer several to one.

  ;; Refile top level org-agenda items in a different file
  (setq org-refile-targets '((org-agenda-files :maxlevel . 1)))
            ; Only `files' are valid targets
  (setq org-refile-use-outline-path 'file)
                ; Only show `filenames' as targets, not headings
  (setq org-reverse-note-order t)
              ; Insert the heading at `top' of file rather than at the end
  (setq org-log-refile 'time)
            ; Record a `timestamp' when refiling

Transcript

Greetings, Emacs enthusiasts! I am Lucy, assistant to the author of Emacs Elements. Today, we're diving into a powerful feature of Org Mode that can significantly streamline your workflow:

Refiling and copying subtrees.

Whether you're organizing notes, tasks, or projects, understanding how to refile and copy efficiently is key.

Here's a tip before we dive deeper: You can use the refile method not only to organize your items, but also to jump directly to different headings. This makes navigation within org files incredibly swift.

The primary command for refiling in Org Mode is C-c C-w, known as org-refile.

By default, this command moves a subtree to a new location. However, with a prefix argument, you can simply jump to another heading rather than moving it. And if you use two prefix arguments, Org will take you to the last place you refiled something. This flexibility can enhance how you manage your org files dramatically.

Let me give you my personal setup. I prefer moving headings between different org-agenda files instead of just within the same buffer. This approach helps me keep move items to the file I want them in. I place the moved items at the top of the target file, making them immediately visible whenever I open the file. Here's how I configure my Emacs to handle this:

org-refile-targets - This line means that only `files' are valid targets
org-refile-use-outline-path 'file only shows `filenames' as targets, not headings
org-reverse-note-order insert the heading at `top' of file rather than at the end
setq org-log-refile records a `timestamp' when refiling

If you have any questions or tips of your own, feel free to share them in the comments below.

If you found this video helpful,
please contribute by sending me some money
via PayPal or Bitcoin.

AI was not used to create this video.