unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo <sdl.web@gmail.com>
To: 4065@emacsbugs.donarmstrong.com
Cc: Carsten Dominik <dominik@uva.nl>
Subject: bug#4065: Possible circular calls in appt-make-list and diary-list-entries (was: bug#4065: 23.1.50; org includes calendar entries on the wrong day)
Date: Wed, 17 Mar 2010 12:44:10 +0000	[thread overview]
Message-ID: <xbaisk7zdso5.fsf@cam.ac.uk> (raw)
In-Reply-To: <m0ocqt5ehi.fsf@cam.ac.uk> (Leo's message of "Thu, 06 Aug 2009 13:11:21 +0100")

Hello,

I investigated this problem a bit and found it is not due to org. It is
a bug in diary and appt.

Appt tries to maintain some sort of backward compatibility by allowing:
(add-hook 'diary-hook 'appt-make-list) to activate appt.

When appt is not activated and appt-make-list is in diary-hook, the
return value of diary-list-entries may be incorrect due to the
following circular calls:

diary-list-entries -> appt-make-list -> appt-activate -> appt-check ->
diary -> diary-list-entries

So one is getting a return value of the second call which can be
different from the first one and that's exactly why org place diary
entries wrongly.

I think a proper fix may probably lie in diary-list-entries or
appt-check/activate.

I have been using the following minimal workaround.

diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el
index b403b70..782b163 100644
--- a/lisp/calendar/appt.el
+++ b/lisp/calendar/appt.el
@@ -518,7 +518,8 @@ For backwards compatibility, this function activates
the
 appointment package (if it is not already active)."
   ;; See comments above appt-activate defun.
   (if (not appt-timer)
-      (appt-activate 1)
+      (let (appt-display-diary)
+        (appt-activate 1))
     ;; We have something to do if the range of dates that the diary is
     ;; considering includes the current date.
     (if (and (not (calendar-date-compare

Thanks.

Leo

On 2009-08-06 13:11 +0100, Leo wrote:
> Please describe exactly what actions triggered the bug
> and the precise symptoms of the bug:
>
> This only happens for the first time running org-agenda in a fresh emacs
> session.
>
> Settings to reproduce the bug with Emacs -q:
>
> (define-key mode-specific-map [?a] 'org-agenda)
> (define-key mode-specific-map [?l] 'org-store-link)
> (setq org-agenda-include-diary t)
>
> (setq calendar-date-style 'european)
> (setq diary-number-of-entries 7)
> (add-hook 'diary-hook 'appt-make-list)
>
> Add an entry to the diary file such as:
>
>     8 Aug 2009 Test2
>
> --------------------------------
> Week-agenda (W32):
> Monday      3 August 2009 W32
>   Diary:      Test2
>   Diary:      
>   Diary:      Thursday, 6 August 2009
>   Diary:      =======================
> Tuesday     4 August 2009
> Wednesday   5 August 2009
> Thursday    6 August 2009
> Friday      7 August 2009
> Saturday    8 August 2009
>   Diary:      Test2
> Sunday      9 August 2009
> --------------------------------






  parent reply	other threads:[~2010-03-17 12:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-06 12:11 bug#4065: 23.1.50; org includes calendar entries on the wrong day Leo
2009-08-06 13:07 ` bug#4066: " Carsten Dominik
2010-03-17 12:44 ` Leo [this message]
2010-03-20 18:21   ` bug#4065: Possible circular calls in appt-make-list and diary-list-entries Glenn Morris
2010-03-20 20:01     ` Leo
2010-09-30  2:24       ` Glenn Morris

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.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xbaisk7zdso5.fsf@cam.ac.uk \
    --to=sdl.web@gmail.com \
    --cc=4065@emacsbugs.donarmstrong.com \
    --cc=dominik@uva.nl \
    /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.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).