From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Griswold Subject: conditionally setting org-agenda-files Date: Sat, 26 Apr 2008 07:34:04 -0400 Message-ID: <87ve247sur.fsf@cantor.griswold.home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jpife-0005Qz-Ar for emacs-orgmode@gnu.org; Sat, 26 Apr 2008 07:34:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jpifa-0005O1-Ow for emacs-orgmode@gnu.org; Sat, 26 Apr 2008 07:34:22 -0400 Received: from [199.232.76.173] (port=52499 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jpifa-0005Ny-Ll for emacs-orgmode@gnu.org; Sat, 26 Apr 2008 07:34:18 -0400 Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jpifa-0006Ax-4z for emacs-orgmode@gnu.org; Sat, 26 Apr 2008 07:34:18 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1JpifS-0002p3-6w for emacs-orgmode@gnu.org; Sat, 26 Apr 2008 11:34:10 +0000 Received: from cpe-66-67-219-205.rochester.res.rr.com ([66.67.219.205]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 26 Apr 2008 11:34:10 +0000 Received: from dgriswol by cpe-66-67-219-205.rochester.res.rr.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 26 Apr 2008 11:34:10 +0000 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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 --------------