From: Nick Dokos <nicholas.dokos@hp.com>
To: Rodrigo Amestica <ramestica@lavabit.com>
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: missing appointments
Date: Thu, 23 Feb 2012 04:02:14 -0500 [thread overview]
Message-ID: <7071.1329987734@alphaville> (raw)
In-Reply-To: Message from Rodrigo Amestica <ramestica@lavabit.com> of "Thu, 23 Feb 2012 00:32:00 EST." <ybizkcauncf.wl%ramestica@lavabit.com>
Rodrigo Amestica <ramestica@lavabit.com> wrote:
> Hi,
>
> I use appt to connect desktop notifications to appointments in my
> agenda. However, the connection between the appointments and the
> notification system does not happen until I visit the agenda with, for
> example, "C-c a a", which I sometimes forget to invoke and I end up
> missing appointments.
>
> Trying to automate I created a short cut like this:
>
> emacs -f org-agenda-list my-main-org-file
>
> However, this seems to execute org-agenda-list before my-main-org-file
> has fully opened in its own buffer and I end up with the window split into
> two buffers: top one scratch and bottom one my-main-org-file, which is
> visually very annoying. It is completely mysterious to me the timing
> at which different actions take place within emacs and how to control
> and sequence them, like a 'wait' call.
>
> Is there a way to automatically execute org-agenda-list after
> my-main-org-file has fully finished opening in its buffer?
>
I think this is the wrong way to go about it.
> Is it there some more streamlined way to connect agenda to
> notifications such that I would not need to explicitly enable them
> every time I open the file?
>
The way to do it is to call org-agenda-to-appt. The trick is to
call this function at all the necessary places/times. I have the following
code in my initialization file, after the rest of org initialization:
--8<---------------cut here---------------start------------->8---
...
(org-agenda-to-appt)
(defadvice org-agenda-redo (after org-agenda-redo-add-appts)
"Pressing `r' on the agenda will also add appointments."
(progn
(setq appt-time-msg-list nil)
(org-agenda-to-appt)))
(ad-activate 'org-agenda-redo)
(add-hook 'org-capture-after-finalize-hook
(function org-agenda-to-appt)
)
;; wrong
(setq org-appt-timer (run-at-time "00:01" nil (function org-agenda-to-appt)))
...
--8<---------------cut here---------------end--------------->8---
There are four pieces here:
o an explicit call - this gets executed at initialization and loads
up the appt-time-msg-list from the agenda.
o advising org-agenda-redo so that after it's done, it resets
appt-time-msg-list and calls org-agenda-to-appt again. That
way, if something goes wrong, I can pop up the agenda, press "r"
and start afresh.
o add a call to org-capture-after-finalize-hook - that way
when I capture an appointment for today, it will be added
automatically.
o finally, I would like to add a call at midnight every day to
recalculate appointments for the next day - unfortunately, the call
above is not correct, so for now I do it manually with an
org-agenda-redo as above. One of these days I'll get that fixed. If
anybody has done that already, I'll gladly steal your code :-)
I *think* that should catch everything. BTW, there is an org-hacks
entry by Russell Adams:
http://orgmode.org/worg/org-hacks.html#org-agenda-appt-zenity
where he suggests also adding it to org-agenda-finalize-hook: that way
it gets done every time you display the agenda as well. Not sure whether
it's necessary or overkill for me, but it certainly wouldn't hurt.
Nick
next prev parent reply other threads:[~2012-02-23 9:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-23 5:32 missing appointments Rodrigo Amestica
2012-02-23 9:02 ` Nick Dokos [this message]
2012-02-23 14:14 ` Memnon Anon
2012-02-23 17:34 ` Bernt Hansen
2012-02-23 19:43 ` Nick Dokos
2012-02-23 23:10 ` Nick Dokos
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=7071.1329987734@alphaville \
--to=nicholas.dokos@hp.com \
--cc=emacs-orgmode@gnu.org \
--cc=ramestica@lavabit.com \
/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).