* missing appointments
@ 2012-02-23 5:32 Rodrigo Amestica
2012-02-23 9:02 ` Nick Dokos
0 siblings, 1 reply; 6+ messages in thread
From: Rodrigo Amestica @ 2012-02-23 5:32 UTC (permalink / raw)
To: emacs-orgmode
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?
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?
thanks,
Rodrigo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: missing appointments
2012-02-23 5:32 missing appointments Rodrigo Amestica
@ 2012-02-23 9:02 ` Nick Dokos
2012-02-23 14:14 ` Memnon Anon
0 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2012-02-23 9:02 UTC (permalink / raw)
To: Rodrigo Amestica; +Cc: nicholas.dokos, emacs-orgmode
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: missing appointments
2012-02-23 9:02 ` Nick Dokos
@ 2012-02-23 14:14 ` Memnon Anon
2012-02-23 17:34 ` Bernt Hansen
0 siblings, 1 reply; 6+ messages in thread
From: Memnon Anon @ 2012-02-23 14:14 UTC (permalink / raw)
To: emacs-orgmode
Nick Dokos <nicholas.dokos@hp.com> writes:
> ;; wrong
> (setq org-appt-timer (run-at-time "00:01" nil (function org-agenda-to-appt)))
[...]
> 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 :-)
http://doc.norang.ca/org-mode.html#sec-14-1
Memnon
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: missing appointments
2012-02-23 14:14 ` Memnon Anon
@ 2012-02-23 17:34 ` Bernt Hansen
2012-02-23 19:43 ` Nick Dokos
0 siblings, 1 reply; 6+ messages in thread
From: Bernt Hansen @ 2012-02-23 17:34 UTC (permalink / raw)
To: Memnon Anon; +Cc: emacs-orgmode, carsten.dominik
Memnon Anon <gegendosenfleisch@googlemail.com> writes:
> Nick Dokos <nicholas.dokos@hp.com> writes:
>
>> ;; wrong
>> (setq org-appt-timer (run-at-time "00:01" nil (function org-agenda-to-appt)))
> [...]
>> 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 :-)
>
> http://doc.norang.ca/org-mode.html#sec-14-1
>
> Memnon
Heh! Even I had to look that up... and it's my document!
For the list archives I think this is the relevant part of the above
link (since the sec-14-1 is likely to change in the future)
--8<---------------cut here---------------start------------->8---
; If we leave Emacs running overnight - reset the appointments one minute after midnight
(run-at-time "24:01" nil 'bh/org-agenda-to-appt)
--8<---------------cut here---------------end--------------->8---
This originally came from Carsten Dominik years ago ... when I was
setting up my appt for the first time.
Thanks Carsten!
Regards,
Bernt
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: missing appointments
2012-02-23 17:34 ` Bernt Hansen
@ 2012-02-23 19:43 ` Nick Dokos
2012-02-23 23:10 ` Nick Dokos
0 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2012-02-23 19:43 UTC (permalink / raw)
To: Bernt Hansen; +Cc: Memnon Anon, nicholas.dokos, emacs-orgmode, carsten.dominik
Bernt Hansen <bernt@norang.ca> wrote:
> Memnon Anon <gegendosenfleisch@googlemail.com> writes:
>
> > Nick Dokos <nicholas.dokos@hp.com> writes:
> >
> >> ;; wrong
> >> (setq org-appt-timer (run-at-time "00:01" nil (function org-agenda-to-appt)))
> > [...]
> >> 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 :-)
> >
> > http://doc.norang.ca/org-mode.html#sec-14-1
> >
> > Memnon
>
> Heh! Even I had to look that up... and it's my document!
>
> For the list archives I think this is the relevant part of the above
> link (since the sec-14-1 is likely to change in the future)
>
> ; If we leave Emacs running overnight - reset the appointments one minute after midnight
> (run-at-time "24:01" nil 'bh/org-agenda-to-appt)
>
> This originally came from Carsten Dominik years ago ... when I was
> setting up my appt for the first time.
>
> Thanks Carsten!
>
Thanks, Memnon! And Bernt and Carsten (and also Russell Adams who had it in
the hack I mentioned yesterday)!
I'm not sure I understand how it works, but I've added it (plus some
debugging) and we'll see how it goes: is the "24:01" a relative time or
an absolute time? I can't make heads or tails of the run-at-time doc.
And what reschedules it for next time? Doesn't the timer fire once (if REPEAT
is nil) and then it's done? I remember I had some misconceptions
about run-at-time before and these are probably more misconceptions on
my part. One of these days, I'll dust the cobwebs out (but they keep
returning...)
Nick
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: missing appointments
2012-02-23 19:43 ` Nick Dokos
@ 2012-02-23 23:10 ` Nick Dokos
0 siblings, 0 replies; 6+ messages in thread
From: Nick Dokos @ 2012-02-23 23:10 UTC (permalink / raw)
To: Rodrigo Amestica
Cc: Bernt Hansen, Memnon Anon, nicholas.dokos, emacs-orgmode,
carsten.dominik
Nick Dokos <nicholas.dokos@hp.com> wrote:
>
> I'm not sure I understand how it works, but I've added it (plus some
> debugging) and we'll see how it goes: is the "24:01" a relative time or
> an absolute time? I can't make heads or tails of the run-at-time doc.
I went through the code: it's an absolute time and it represents one minute
past midnight of the next day (my original "00:01" was one minute past midnight
of the current day, i.e. some time in the past).
> And what reschedules it for next time? Doesn't the timer fire once (if REPEAT
> is nil) and then it's done?
Still not clear about this though. I'll see what happens at midnight tonight.
Nick
PS. BTW, I was just looking through Bernt's document and saw that in my earlier
mail, I missed the activation of appointments:
(appt-activate 1)
So that's one more thing for the OP to add to his .emacs.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-02-23 23:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-23 5:32 missing appointments Rodrigo Amestica
2012-02-23 9:02 ` Nick Dokos
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
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).