From: Richard KLINDA <rklinda@gmail.com>
To: emacs-orgmode@gnu.org
Subject: TIP: set up org-agenda-files automagically
Date: Fri, 06 Feb 2009 12:50:47 +0100 [thread overview]
Message-ID: <87zlgz942w.fsf@gmail.com> (raw)
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
reply other threads:[~2009-02-06 11:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zlgz942w.fsf@gmail.com \
--to=rklinda@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.