From: Dan Griswold <dgriswol@rochester.rr.com>
To: emacs-orgmode@gnu.org
Subject: conditionally setting org-agenda-files
Date: Sat, 26 Apr 2008 07:34:04 -0400 [thread overview]
Message-ID: <87ve247sur.fsf@cantor.griswold.home> (raw)
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
--------------
reply other threads:[~2008-04-26 11:34 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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ve247sur.fsf@cantor.griswold.home \
--to=dgriswol@rochester.rr.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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).