[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] TIP: set up org-agenda-files automagically
From: |
Richard KLINDA |
Subject: |
[Orgmode] TIP: set up org-agenda-files automagically |
Date: |
Fri, 06 Feb 2009 12:50:47 +0100 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) XEmacs/21.4 (Educational Television, linux) |
Here is a little code snippet for setting up the org-agenda-files
variable via elisp code, to only include files modified in the last X
days.
I use this, because I have ~500 org files and if I add all of them to
org-agenda-files then creating agenda buffers takes up just too much
time[1], and it is wasted effort anyway, because I only use a handful of
them on a day-to-day basis.
,----
| (defun rk-filter-new-files (max-age files)
| "Returns only files that were modified MAX-AGE days ago."
| (let ((current-day (time-to-days (current-time))))
| (loop for file in files
| for age = (time-to-days (nth 5 (file-attributes file)))
| if (< (- current-day age)
| max-age)
| collect file)))
|
| (setq org-agenda-files (rk-filter-new-files
| 380
| (append (directory-files "~/.xemacs/org/" t nil nil t)
| (directory-files "~/.Wiki/" t nil nil t))))
`----
Footnotes:
[1] I don't want to add them manually 1-by-1 either.
--
Udv, Richard
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Orgmode] TIP: set up org-agenda-files automagically,
Richard KLINDA <=