user96235
user96235

Reputation:

Archive all past calendar items in Org-mode?

I'm becoming addicted to Org-mode, particularly the way that calendar items (aka timestamped items) and TODOs are both equal-class citizens in a project tree. As time goes on, many of those calendar items slip into the past.

I'd love a single keybind that would automatically archive any timestamped/calendar item (n.b.: not a scheduled item or a deadlined item, and preferably only things without TODO types) that has already happened.

Is there something like this already available in Org-mode? Can anybody point me in the direction of how to write something like org-archive-past-items-in-buffer? (My elisp skills are weak.) Thanks!

(EDIT: I should note that I mean archive in the sense of archive files C-c $, not archive in the sense of archive tags/siblings C-c C-x a or C-c C-x A.)

Upvotes: 6

Views: 616

Answers (1)

bzg
bzg

Reputation: 2605

I would create a new agenda custom entry like this:

(setq org-agenda-custom-commands
  '(("P" ((tags "TIMESTAMP<=\"<now>\"")))))

Then C-c a P % . RET $ will archive all items in the resulting agenda view (assuming C-c a is bound to `org-agenda'.)

Related and complementary, C-c / b RET will create a sparse tree with scheduled and deadline items before today (or a date you interactively enter.) You can then navigate the buffer with C-c C-n (or just n at the beginning of the line if `org-use-speed-commands' is non-nil) and archive the entries.

Upvotes: 5

Related Questions