emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* TIP: set up org-agenda-files automagically
@ 2009-02-06 11:50 Richard KLINDA
  0 siblings, 0 replies; only message in thread
From: Richard KLINDA @ 2009-02-06 11:50 UTC (permalink / raw)
  To: emacs-orgmode

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

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))))

[1]  I don't want to add them manually 1-by-1 either.

Udv, Richard

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-02-06 11:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-06 11:50 TIP: set up org-agenda-files automagically Richard KLINDA

Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).