Nathaniel Saxe
Nathaniel Saxe

Reputation: 1555

Emacs org mode refile to main tree and not as a subtree

I have two files and I have set it up so that i can refile any of the items from refile.org and into todo.org.

File 1- refile.org
* TODO Task 1
* TODO Task 2
* TODO Task 3
* TODO Task 4
etc


File 2- todo.org
* TODO Task 5
** TODO Task 1

The only thing is that I can only refile it as a subtree of Task 5 and not as its own tree. Am i missing something or is there a way to do this so that i can get:

    File 1- refile.org
* TODO Task 1
* TODO Task 2
* TODO Task 3
* TODO Task 4
etc


File 2- todo.org
* TODO Task 5
* TODO Task 1

Thanks

Upvotes: 10

Views: 3956

Answers (2)

Brady Trainor
Brady Trainor

Reputation: 2076

If you want to use Ido completion, you may want to change org-outline-path-complete-in-steps. My settings include

(setq org-refile-use-outline-path 'file)
(setq org-refile-targets 
      `(
        (
         ,(append org-agenda-files (list tech))
         :regexp . "refile")
        (
         ,(append org-agenda-files (list tech))
         :maxlevel . 1)
        ))
(setq org-completion-use-ido t)
(setq org-outline-path-complete-in-steps nil)
(setq org-reverse-note-order t)

Right after C-c C-w, I can see just the file names. But if I move around, level one subtrees will show up. I haven't made any refile subtrees yet, but hopefully the first target description will behave nicely.

I also have reverse-note-order so that new items won't end up lost at the bottom of the target.

The tech variable expands to wherever I happen to be storing that. I don't want to put that in my org-agenda-files, it's stuff I really don't need to be doing, but I do want to refile to there.

Upvotes: 5

pmr
pmr

Reputation: 59841

If you specify org-refile-use-outline-path to be 'file it is possible to just use the path of the file as the refile target and the node will be entered at the top-level.

(setq org-refile-use-outline-path 'file)
(setq org-refile-targets '((org-agenda-files :level . 1)))

You can see the full documentation of org-refile-use-outline-path with C-h v org-refile-use-outline-path RET.

Upvotes: 10

Related Questions