Internal archiving in Org Mode
How to archive Org Mode items to a heading in the same file instead of creating separate archive files
I quite like the idea of Org Mode and go back and forth on
actually using it every few years. Sometimes I just use it for simple bug/todo tracking when hacking on
something - it's nice and handy just as a basic outliner for collecting notes/links and stuff, and TODO/PENDING/DONE is nice for keeping work straight in my own head. Items do
pile up, though, and it's good to get things out of the main flow of text once they're dealt with, which is
what "archiving" is for. Unfortunately,
the default is for it to create a foo.org_archive
file next to foo.org, which is somewhat logical, and fine with in a mass of org files in ~/org, but a bit annoying if it's TODO.org in an unrelated and otherwise-un-org-y project. What I'd rather is to just hide things away under another heading and keep it hidden,
which are both things Org Mode does well.
So, it's a three step process: First, make a heading that's a sibling to * To Do where things
will get archived to, secondly
set the
ARCHIVE tag (not property) on it with C-c C-x a aka
org-toggle-archive-tag so that it will be hidden by default and not included in the agenda.
Finally, configure the the archive location of a subtree - I always have a root * To Do tree I
put things under, so this aligns well - setting this on that root handles all items. It's a property like
this:
* To Do
:PROPERTIES:
:ARCHIVE: ::* Archive
:END:
This can also be set using C-c C-x p aka org-set-property - here it's set to ::* Archive.
A full example file looks like this:
* To Do
:PROPERTIES:
:ARCHIVE: ::* Archive
:END:
** Something I'm About To Archive
* Archive :ARCHIVE:
Voila, now C-c $ on Something I'm About To Archive will archive it in to the same
file.
edit: Coming back to this a year later, I already forgot the
:ARCHIVE: target must start with ::, as above.
edit: coming back to this two years later, I see I didn't even get the code block right the first time!