emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Old entry remains in appt when the original one in org file is changed
@ 2012-01-13 16:01 Takafumi Arakaki
  2012-01-16  2:44 ` Bernt Hansen
  0 siblings, 1 reply; 5+ messages in thread
From: Takafumi Arakaki @ 2012-01-13 16:01 UTC (permalink / raw)
  To: emacs-orgmode

I am using org-agenda-to-appt and I noticed a bug.


1. Add the following in the agenda file

* TODO test
  SCHEDULED: <2012-01-14 Sat 12:00>

2. Call org-agenda-to-appt

3. Change the SCHEDULED time-stamp in the entry like this

* TODO test
  SCHEDULED: <2012-01-14 Sat 12:00>

4. appt-time-msg-list has the old entry

 ((1380)
  #("12:00 TODO test" 6 15
    (org-heading t))
  t)
 ((1390)
  #("12:10 TODO test" 6 15
    (org-heading t))
  t)


I guess a workaround will be removing any entries which has
org-heading as property from appt-time-msg-list before adding the new
entries.

I think this guy had the same problem:
http://article.gmane.org/gmane.emacs.orgmode/8008/

--
Takafumi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Old entry remains in appt when the original one in org file is changed
  2012-01-13 16:01 Old entry remains in appt when the original one in org file is changed Takafumi Arakaki
@ 2012-01-16  2:44 ` Bernt Hansen
  2012-01-17  7:02   ` Takafumi Arakaki
  0 siblings, 1 reply; 5+ messages in thread
From: Bernt Hansen @ 2012-01-16  2:44 UTC (permalink / raw)
  To: Takafumi Arakaki; +Cc: emacs-orgmode

Takafumi Arakaki <aka.tkf@gmail.com> writes:

> I am using org-agenda-to-appt and I noticed a bug.
>
>
> 1. Add the following in the agenda file
>
> * TODO test
>   SCHEDULED: <2012-01-14 Sat 12:00>
>
> 2. Call org-agenda-to-appt
>
> 3. Change the SCHEDULED time-stamp in the entry like this
>
> * TODO test
>   SCHEDULED: <2012-01-14 Sat 12:00>
>
> 4. appt-time-msg-list has the old entry
>
>  ((1380)
>   #("12:00 TODO test" 6 15
>     (org-heading t))
>   t)
>  ((1390)
>   #("12:10 TODO test" 6 15
>     (org-heading t))
>   t)
>
>
> I guess a workaround will be removing any entries which has
> org-heading as property from appt-time-msg-list before adding the new
> entries.
>
> I think this guy had the same problem:
> http://article.gmane.org/gmane.emacs.orgmode/8008/

Hi Takafumi,

This is the setup I use to deal with this.

There is no magic that updates your appt-time-msg-list just because your
org file changed.  I regenerate the appointment list everytime I visit
the agenda -- and I do that often.

HTH,
Bernt


--8<---------------cut here---------------start------------->8---
; Erase all reminders and rebuilt reminders for today from the agenda
(defun bh/org-agenda-to-appt ()
  (interactive)
  (setq appt-time-msg-list nil)
  (org-agenda-to-appt))

; Rebuild the reminders everytime the agenda is displayed
(add-hook 'org-finalize-agenda-hook 'bh/org-agenda-to-appt 'append)

; This is at the end of my .emacs - so appointments are set up when Emacs starts
(bh/org-agenda-to-appt)

; Activate appointments so we get notifications
(appt-activate t)

; 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---

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Old entry remains in appt when the original one in org file is changed
  2012-01-16  2:44 ` Bernt Hansen
@ 2012-01-17  7:02   ` Takafumi Arakaki
  2012-01-17 15:01     ` Bernt Hansen
  0 siblings, 1 reply; 5+ messages in thread
From: Takafumi Arakaki @ 2012-01-17  7:02 UTC (permalink / raw)
  To: emacs-orgmode

Hi Bernt,

Thanks for your setup recipe. However, I noticed I failed to explain
what I meant; the old entry remains in appt-time-msg-list even if you
call org-agenda-to-appt.

So, the procedure to reproduce my problem is the following:


1. Add the following in the agenda file

* TODO test
 SCHEDULED: <2012-01-14 Sat 12:00>

2. Call org-agenda-to-appt

3. Change the SCHEDULED time-stamp in the entry like this

* TODO test
 SCHEDULED: <2012-01-14 Sat 12:00>

4. Call org-agenda-to-appt again  # ADDED THIS

5. appt-time-msg-list has the old entry

 ((1380)
 #("12:00 TODO test" 6 15
  (org-heading t))
 t)
 ((1390)
 #("12:10 TODO test" 6 15
  (org-heading t))
 t)


I found how to fix this. You can tell org-agenda-to-appt forcefully
clear the old entries by passing non-nil to the first argument of
org-agenda-to-appt.

This is how I use it:


(defun my-org-agenda-to-appt-when-saved ()
 (when (member buffer-file-name (mapcar 'expand-file-name org-agenda-files))
   (org-agenda-to-appt t)))

(add-hook 'after-save-hook 'my-org-agenda-to-appt-when-saved)


Note that this will clear all entries stored in appt, including the
ones unrelated to org-mode. But if you are using appt only from
org-mode, there is no problem.


--
Takafumi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Old entry remains in appt when the original one in org file is changed
  2012-01-17  7:02   ` Takafumi Arakaki
@ 2012-01-17 15:01     ` Bernt Hansen
  2012-01-18 18:01       ` Takafumi Arakaki
  0 siblings, 1 reply; 5+ messages in thread
From: Bernt Hansen @ 2012-01-17 15:01 UTC (permalink / raw)
  To: Takafumi Arakaki; +Cc: emacs-orgmode

Takafumi Arakaki <aka.tkf@gmail.com> writes:

> Hi Bernt,
>
> Thanks for your setup recipe. However, I noticed I failed to explain
> what I meant; the old entry remains in appt-time-msg-list even if you
> call org-agenda-to-appt.

My recipe clears the list each time the agenda is generated.  I only use
appt for org-mode appointments so clearing the list works great for me.

Regards,
Bernt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Old entry remains in appt when the original one in org file is changed
  2012-01-17 15:01     ` Bernt Hansen
@ 2012-01-18 18:01       ` Takafumi Arakaki
  0 siblings, 0 replies; 5+ messages in thread
From: Takafumi Arakaki @ 2012-01-18 18:01 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Hi Bernt,

> My recipe clears the list each time the agenda is generated.  I only use
> appt for org-mode appointments so clearing the list works great for me.

Sorry I missed (setq appt-time-msg-list nil) in your setup code.  This
is exactly what happens when you pass non-nil for REFRESH argument of
org-agenda-to-appt.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-01-18 18:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-13 16:01 Old entry remains in appt when the original one in org file is changed Takafumi Arakaki
2012-01-16  2:44 ` Bernt Hansen
2012-01-17  7:02   ` Takafumi Arakaki
2012-01-17 15:01     ` Bernt Hansen
2012-01-18 18:01       ` Takafumi Arakaki

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).