[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] conditionally setting org-agenda-files
From: |
Dan Griswold |
Subject: |
[Orgmode] conditionally setting org-agenda-files |
Date: |
Sat, 26 Apr 2008 07:34:04 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
Hi all,
I have come up with the following snippet of elisp, which I designed
to include or exclude certain files in org-agenda-files based on the
week day and the time:
/----------------------------
;;; conditionally remove agendas based on time and day
(require 'tinylibm)
(setq nowday (nth 4 (ti::date-time-elements)))
(setq nowtime (nth 3 (ti::date-time-elements)))
(setq nowhour (nth 0 (split-string nowtime ":")))
(setq workfile "/home/dan/org/work.org")
(setq homefile "/home/dan/org/personal.org")
(when
(and (string< nowhour "17")
(or
(string= "Tue" nowday)
(string= "Wed" nowday)
(string= "Thu" nowday)
(string= "Fri" nowday)))
(setq thisbuffer (buffer-name))
(org-remove-file homefile)
(find-file workfile)
(org-agenda-file-to-front)
(switch-to-buffer thisbuffer)
)
(when
(and (string> nowhour "16")
(or
(string= "Tue" nowday)
(string= "Wed" nowday)
(string= "Thu" nowday)
(string= "Fri" nowday)))
(setq thisbuffer (buffer-name))
(org-remove-file workfile)
(find-file homefile)
(org-agenda-file-to-front )
(switch-to-buffer thisbuffer)
)
(when
(or (string= "Sat" nowday)
(string= "Sun" nowday))
(setq thisbuffer (buffer-name))
(find-file workfile)
(org-agenda-file-to-front)
(find-file homefile)
(org-agenda-file-to-front )
(switch-to-buffer thisbuffer)
)
(when (string= "Mon" nowday)
(setq thisbuffer (buffer-name))
(org-remove-file workfile)
(find-file homefile)
(org-agenda-file-to-front)
(switch-to-buffer thisbuffer)
)
\----------------------------
Two things that are peculiar to my situation: I usually am working on
weekends, and Monday is my day off.
I welcome your comments and suggestions.
Peace,
Dan
--
--------------
Dan Griswold
Rochester, NY
--------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Orgmode] conditionally setting org-agenda-files,
Dan Griswold <=