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
--------------
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-orgmode