From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id GCzNGx7gZWZPgAAAqHPOHw:P1 (envelope-from ) for ; Sun, 09 Jun 2024 19:02:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id GCzNGx7gZWZPgAAAqHPOHw (envelope-from ) for ; Sun, 09 Jun 2024 19:02:22 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=VP5BOV1q; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1717952542; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=K8NEbs7FA+9mXn32t5fhGYYqHuF2Cw3QfR+sg0tAhqM=; b=Nab45COo0Tr6KXCbFsdzUPydQ7q3ZPjRfDMD9ROcIzEImipq1R8TlIeaQAqT1mM9DJMowA j5QJnDCs9o0pETuYiddJvriTdqGNrSl25qXopm62oy8Jrk8m0kWWXXMpg1qhtjVEyGLzI0 DTey5MYPVz3Yn/XPIKS6qMyOs0X2cFwLh66CTTqkkmziDf1ks8BdlmxW+cfx1T0TDFfu6L jcgA/UUaHVPj/uvrlRKOdRIkQhl4BYCnuZczlsuguKjqxzrebUVfXPEmfZS7oTUtoqsdlM I6VQ4gmbGviPIXlcUHnmjOzuDRNKsIJuDlPl1YYYVzGw2F63c2P9IhBt5CurDQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1717952542; a=rsa-sha256; cv=none; b=OhJYVNoJXwo/YGWD+4oKNMc1NBx4+8OLglWJMv+PA32F+r3xk1giyYz3hpqgEzN6V4QBSr 1dWj7clSu9lrMyAmovt2DfMFeXJScCW+/73YbWnZ19GXRRyB6U5IzRB4/oUI9zyLvxaKTu Mc0AOAq3uRWTeP8VRbnkcC01y6XU8TzTtxepB+ESzgEp3jL2LiiW/Uk9RwMyjqfSHzj1e+ qMP7Lvxg+6cHNxKntP3G75k8nD4OSFJ6JP8k8Hkj9DFXfelr4fSr7BoqRrGyIaKpL0eAUg 5BYRbermRW9JSCxhEIUpE+IPZy6uljobwYw4C1/cnO/vQEPLEpF/4sZ4zgCs5g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=VP5BOV1q; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3EFC7728B7 for ; Sun, 09 Jun 2024 19:02:22 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sGLvI-0006hZ-1w; Sun, 09 Jun 2024 13:01:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sGLvG-0006h9-OM for emacs-orgmode@gnu.org; Sun, 09 Jun 2024 13:01:38 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sGLvE-0001u3-T1 for emacs-orgmode@gnu.org; Sun, 09 Jun 2024 13:01:38 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 2AE3F240028 for ; Sun, 9 Jun 2024 19:01:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1717952494; bh=FR2SS80CKjnrIYlE1A2f1vvizzqyJUZYPFdMMJBZRok=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=VP5BOV1qYfiQWqNOayDx75d6B8i95Vq9mS5HffIrhrCIs5UZ88qXxtRhx1iHhsNlY yZ6ITZbHvrmO2WBDWOl/dcugmbDIGsgtUiXfgTKZuH0pKaJqVzWJIQXRgCcC6Pm3/A FMfS5Nq1K5JCpZlYSH/Ajh0aY0VeqjZqEpOFf3OmjWPTpKpUnr1eZMgPjqeDEgrShb 7hpSDMmd2jE8hmAheJxk0g6LpzCHU7Eh6hjwEcAuCfhxnQCw8yo2keD/uQNMWC1C0n Zn38Db8gBxJfqOOFawDUTa1Bm9yG8OVWCxclmIAfULf1ExX0giPyvjYRedgAr0wnJM Ok4I2cCDDYtuQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Vy1Rx4sfkz6tx0; Sun, 9 Jun 2024 19:01:33 +0200 (CEST) From: Ihor Radchenko To: Nafiz Islam Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] function and symbol for headline and olp for org-capture-templates In-Reply-To: References: <42f22002-b17b-40ab-a8de-3a0df5091be9@gmail.com> <87plsvpxh5.fsf@localhost> <87frtpgj2w.fsf@localhost> Date: Sun, 09 Jun 2024 17:03:14 +0000 Message-ID: <877cey2gml.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.55 X-Spam-Score: -6.55 X-Migadu-Queue-Id: 3EFC7728B7 X-Migadu-Scanner: mx11.migadu.com X-TUID: u77P8mrUJVwN Nafiz Islam writes: >> I tried to run make test with your patch, and it is failing: > > On my side it passes on main branch at commit 6c862699a6db3f6b76391c05380d92d9f1b3838f with patch. > passed 444/1207 test-org-capture/entry (0.099791 sec) > ... > passed 447/1207 test-org-capture/org-capture-expand-olp (0.001104 sec) > > Apparently, you get > `"* A\n** B\n*** 1970\n**** 1970-01 January\n***** 1970-01-01 Thursday\n****** H1 Capture text\n** C\n"' > > Whereas I get the expected result of > `"* A\n** B\n*** 1969\n**** 1969-12 December\n***** 1969-12-31 Wednesday\n****** H1 Capture text\n** C\n"' > > What do you get if you evaluate `(calendar-gregorian-from-absolute (time-to-days 0))'? I get `(12 31 1969)'. > I set `org-overriding-default-time' to `0' for testing with datetree. I get (1 1 1970). It is probably more reliable to use `org-test-at-time' macro. >>> I don't have to additionally test for whether the lambda (as a target) >>> is actually called while visiting the file right? >> May you elaborate what you mean? > > So I've written a test for lambda-based target. > > (should > (equal > "* A\n* B\n** H1 Capture text\n* C\n" > (org-test-with-temp-text-in-file "* A\n* B\n* C\n" > (let* ((file (buffer-file-name)) > (org-capture-templates > `(("t" "Todo" entry (file+headline ,file ,(lambda () "B")) "** H1 %?")))) > (org-capture nil "t") > (insert "Capture text") > (org-capture-finalize)) > (buffer-string)))) > > But it does not verify that the lambda `(lambda () "B")' is actually being called while > visiting the file which would allow reading the file to compute or generate a headline. > So I'm wondering if I should write a test for that too. Maybe for each new lambda target? You can. Maybe even as a part of the above test (and similar): `(("t" "Todo" entry (file+headline ,file (lambda () (should (equal ,file (buffer-file-name))) "B")) "** H1 %?")) -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at