Let me preface this with letting you know that I don't use org-mode for an agenda, so I have no experience with it; this is just an idea.
If you use
C-c C-t to cycle states from
LATER and have it automatically refile the entry into your
later.org file, I could foresee this being an issue if you are trying to cycle past
DONE (or another state) because, as soon as it hits LATER, the entry would move to your other file and you would then have to swap to that other file to continue cycling.
To circumvent that issue, I would create a dedicated keybinding to call a custom function that would do the following:
- Toggle the state of the entry directly to
LATER (regardless of
what other states you have defined) by calling the pre-defined function
org-todo with the ARG,
- Call the function
org-todo without any arguments simply cycles through states (which is what
C-c C-t does by default), while including an ARG of a specific state sets the entry to the specified state.
org-refile is what
C-c C-w does by default
AHA! I think I've managed to write some code to do exactly what you're looking to do!
Here is an example of what this might look like in elisp for your configuration file (note: I'm brand new to lisp, so if someone knows a better way to write/format this, please chime in):
Change the keybinding to anything you like (where I wrote "C-c c")
Also change the values in
org-todo-keywords to point to your files and match your keywords
* Test =org-agenda= TODO/LATER toggle & refile for Tohiko
(defun tohiko/org-toggle-later-todo-and-refile ()
;; if currently set to TODO, swap it to LATER and refile
((string= (org-get-todo-state) "TODO")
(org-refile nil nil (list "NewHeadline" "~/gtd/later.org")))
;; if currently set to LATER, swap it to TODO and refile
((string= (org-get-todo-state) "LATER")
(org-refile nil nil (list "NewHeadline" "~/gtd/current.org")))
;; if neither TODO nor LATER, do nothing but print a message
(t (message "Oops! This item is neither TODO nor LATER"))))
;; define a keybinding that will call the above function when pressed
(define-key org-mode-map (kbd "C-c c") 'tohiko/org-toggle-later-todo-and-refile)
** Set refile targets
(setq org-refile-targets '((nil :maxlevel . 9)
(org-agenda-files :maxlevel . 9)))
** Set agenda files
(setq org-agenda-files '("~/gtd/current.org"
** Set todo keywords
(setq org-todo-keywords '((sequence "TODO" "LATER" "DONE")))
Don't forget to also change the path to the files in each of the two calls to
org-refile in the custom function to match the paths to your files
Hope that helps!