From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.bugs 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 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1268830506 1281 80.91.229.12 (17 Mar 2010 12:55:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 17 Mar 2010 12:55:06 +0000 (UTC) Cc: Carsten Dominik To: 4065@emacsbugs.donarmstrong.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Mar 17 13:55:01 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nrsm5-0000bc-2f for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Mar 2010 13:55:01 +0100 Original-Received: from localhost ([127.0.0.1]:44941 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nrsm4-0002Ko-I6 for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Mar 2010 08:55:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nrsm0-0002KU-6Z for bug-gnu-emacs@gnu.org; Wed, 17 Mar 2010 08:54:56 -0400 Original-Received: from [140.186.70.92] (port=33684 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nrslx-0002KH-VX for bug-gnu-emacs@gnu.org; Wed, 17 Mar 2010 08:54:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nrslw-0000x3-7x for bug-gnu-emacs@gnu.org; Wed, 17 Mar 2010 08:54:53 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44574) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nrslw-0000wy-6E for bug-gnu-emacs@gnu.org; Wed, 17 Mar 2010 08:54:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1NrscQ-0007Zh-Rv; Wed, 17 Mar 2010 08:45:02 -0400 X-Loop: bug-gnu-emacs@gnu.org Resent-From: Leo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Mar 2010 12:45:02 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-GNU-PR-Message: followup 4065 X-GNU-PR-Package: emacs,org-mode X-GNU-PR-Keywords: Original-Received: via spool by 4065-submit@debbugs.gnu.org id=B4065.126882985829094 (code B ref 4065); Wed, 17 Mar 2010 12:45:02 +0000 Original-Received: (at 4065) by debbugs.gnu.org; 17 Mar 2010 12:44:18 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nrsbh-0007ZD-NU for submit@debbugs.gnu.org; Wed, 17 Mar 2010 08:44:17 -0400 Original-Received: from ppsw-5.csi.cam.ac.uk ([131.111.8.135]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nrsbg-0007Z7-Gv for 4065@emacsbugs.donarmstrong.com; Wed, 17 Mar 2010 08:44:16 -0400 X-Cam-AntiVirus: no malware found X-Cam-SpamDetails: not scanned X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Original-Received: from smaug.linux.pwf.cam.ac.uk ([193.60.95.72]:37570) by ppsw-5.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.155]:587) with esmtpsa (LOGIN:sl392) (TLSv1:DHE-RSA-AES128-SHA:128) id 1Nrsba-0001Q9-J5 (Exim 4.70) (return-path ); Wed, 17 Mar 2010 12:44:10 +0000 In-Reply-To: (Leo's message of "Thu, 06 Aug 2009 13:11:21 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 17 Mar 2010 08:45:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:35607 Archived-At: 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 > --------------------------------