Re: [PATCH] Bind calendar-debug-sexp to non-nil when running tests (was: problem with diary sexps)

2022-11-10 Thread Ihor Radchenko
Ihor Radchenko  writes:

> I guess we can permanently bind calendar-debug-sexp to non-nil in tests.
> It should help if we encounter diary-related issues in future.

Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=c41a2198f2d7a3fbae5953f4b25c84cbe6692e2e

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



[PATCH] Bind calendar-debug-sexp to non-nil when running tests (was: problem with diary sexps)

2022-10-18 Thread Ihor Radchenko
Max Nikulin  writes:

>> More accurate error can be found after setting calendar-debug-sexp to t.
>> I got the following backtrace clearly indicating lexical scope issue:
>> 
>> Debugger entered--Lisp error: (void-variable entry)
>>(diary-float t 2 1)
>>(let ((entry "") (date '(4 5 2022))) (diary-float t 2 1))
>>(eval (let ((entry "") (date '(4 5 2022))) (diary-float t 2 1)) t)
>
> It looks like the source of the problem with unit tests that I faced 
> yesterday trying to look closer at the bug with daylight saving time in 
> agenda.

I guess we can permanently bind calendar-debug-sexp to non-nil in tests.
It should help if we encounter diary-related issues in future.

WDYT?

>From e86bbe12b79f9958fcd5ccf1586e9d9c829ee8c2 Mon Sep 17 00:00:00 2001
Message-Id: 
From: Ihor Radchenko 
Date: Wed, 19 Oct 2022 10:28:40 +0800
Subject: [PATCH] testing: Provide more debug info for diary sexps

* testing/org-test.el (org-test-run-batch-tests):
(org-test-run-all-tests): Bind `calendar-debug-sexp' to non-nil when
running tests.

See https://orgmode.org/list/t2hpe9$119m$1...@ciao.gmane.io
---
 testing/org-test.el | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/testing/org-test.el b/testing/org-test.el
index 9f7bab9ea..65d157bca 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -457,7 +457,9 @@ (defun org-test-run-batch-tests ( org-test-selector)
   (let ((org-id-track-globally t)
 	(org-test-selector
 	 (if org-test-selector org-test-selector "\\(org\\|ob\\)"))
-	org-confirm-babel-evaluate org-startup-folded vc-handled-backends)
+	org-confirm-babel-evaluate org-startup-folded vc-handled-backends
+;; Catch errors in diary sexps better.
+(calendar-debug-sexp t))
 (org-test-touch-all-examples)
 (org-test-update-id-locations)
 (org-test-load)
@@ -471,7 +473,9 @@ (defun org-test-run-all-tests ()
   (org-test-touch-all-examples)
   (org-test-update-id-locations)
   (org-test-load)
-  (ert "\\(org\\|ob\\)")
+  (let (;; Catch errors in diary sexps better.
+(calendar-debug-sexp t))
+(ert "\\(org\\|ob\\)"))
   (org-test-kill-all-examples))
 
 (defmacro org-test-at-time (time  body)
-- 
2.35.1



-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at