From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id AO+SI37DZWZxKwEAe85BDQ:P1 (envelope-from ) for ; Sun, 09 Jun 2024 17:00:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id AO+SI37DZWZxKwEAe85BDQ (envelope-from ) for ; Sun, 09 Jun 2024 17:00:14 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=gtwvr62A; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1717945214; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=t1PCX5bzd/ER0ndgMKwU+uT+7nU8c6DP3S3+30k11oU=; b=Rql5SQLIJtRaVoJZXZYX/9kCz+SbtX96q1wSU0oe0GnFHeA5XG3GtJTgKmsk6fXKC1xlP/ D6kFvkgLHK2/CShnm8gBTKsjNEc826vpQJcIHbBK4J+KW3Fny9nh71WVPZ4pVIqvKn65cj WzHo2rNOqnRs0mfl8OtDhvHMKqxhlPjWHzHbF8hAxU0Nsw4FWcSen4Krn2YTQYChKCdL0V kXvs98xo5kotF4V/qFXi/9Bp5xfavoVIF++90/YOhUSblQLWEx26HrgttvKGVnj/Wu/uy3 Cc3J4oNQGctUx705BzPTU5DMNgedpFzm7tDzlNFACdeHUh62IaylkF6I1kF+yw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=gtwvr62A; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1717945214; a=rsa-sha256; cv=none; b=A0TYmErbvGygMDFxiBYGzBdGsOamasRBj6mqWk95gH4SJSB/lz8QI5i/phDSTK02pEi9iD HFmxCqAHABGroNzDDeLoS/VlVk0QIre6kSp/uJvtWM/4Q5W9b2avZVjXx5k2p71pexeBRD 2kgklipI1Ys7IKonn4UkO2AnO3nLqOZO4MJ5hxg8iU3qMO9IsqxzukYkfsAQjtnwQthOLZ pQZ+r22UHROuM1EEDDJzho4nWtN3A3LgcXiuruCM7cX4eNHv23rb3YJMZXSNIZHPRIucp1 xkJhHhCi8OWhSyi8KJ3LBuWSJdgPx5WzSV0SdOfPh0NC/ylgIaPpIomJfL/eaA== 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 49CAB57140 for ; Sun, 9 Jun 2024 17:00:14 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sGK12-0007Q0-Nf; Sun, 09 Jun 2024 10:59:28 -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 1sGK10-0007Ph-O8 for emacs-orgmode@gnu.org; Sun, 09 Jun 2024 10:59:27 -0400 Received: from mail-oa1-x34.google.com ([2001:4860:4864:20::34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sGK0x-0002Nn-QE for emacs-orgmode@gnu.org; Sun, 09 Jun 2024 10:59:25 -0400 Received: by mail-oa1-x34.google.com with SMTP id 586e51a60fabf-250e4c4d650so1821729fac.2 for ; Sun, 09 Jun 2024 07:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717945148; x=1718549948; darn=gnu.org; h=content-transfer-encoding:in-reply-to:cc:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=t1PCX5bzd/ER0ndgMKwU+uT+7nU8c6DP3S3+30k11oU=; b=gtwvr62Aq6Wi/qf+dLvXnUwkJ5rU7IF7AjSosZ4t/Dq+ldhIEZOaM8LI+C+MVyk2Pu Rb1BvYsSKvobMTEajUhEuvY2vXDv9DeQ30TACxiMrv9PKcgfMSCMtWJojfR2ItrkfRTU cXUJJ7Hl4RSLxAhG+M6ZMJoFSe8/uItop2wBx2E4K9ncZHXEhtgLG2I012hXxR3V2Pm6 3Bq1zLQVgQketwH5XmRHkseE7gXBmkAbqs3treD+idYcfzvW6ct26xkjVpVa7Oiu/lwJ 7u8dFuvB2mCugPaTfkQIXeMN9Yb6XEhXst5LUb0jxJ4J+o74jL74JwZToLmDTGCXaTcw Na5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717945148; x=1718549948; h=content-transfer-encoding:in-reply-to:cc:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=t1PCX5bzd/ER0ndgMKwU+uT+7nU8c6DP3S3+30k11oU=; b=FFPFIMrtp7V0vWR1dhxTfTiBoiAwZ0hV5luYrZM6Admp9U0YW9mKHhyUxs7cRdCB3N a0LkcKg2ZpKifgYZwheUoGncMpGAaGVdNeRiVnPDrh7mFqCvnRRnWtgGkKAUziG8uhNH iITvcAkVihMSFwRtZ3phfck5LVaAI8LQsAiwPL3eS+QF0C8wd64s/BWPlWOkZduifR00 pQHf3hU+IbASuRWGyqJJ11gcjZtc2nHY36j414osaDRibTzKwl5AWRCUE8P7jOSSywPq 1fEtKBFfXqM/ORJH4ncn5A2ybrxiwnp8wfZY2uFdcWnIbyeIx6IOPl7tHjMKy101vRpy aC9Q== X-Gm-Message-State: AOJu0YyPmsycI2+uP/0TTNWN/vW2JNe5BTZCBP71Pt40aiWoUgFlp1uh pg3Dr+y7VhUeXPk+U9DLZLDnjk9xRkUv9w3aS5zyNga92bBNLdU= X-Google-Smtp-Source: AGHT+IFPPWcqw72o+8uhkZL6uhBS9chuDzk+JRx11I41lznwTOVbCg8rWA8YEO5Rfhz5JaD6Cw1R8A== X-Received: by 2002:a05:6870:315:b0:254:88ed:c9ba with SMTP id 586e51a60fabf-25488ee80bamr5869843fac.44.1717945147794; Sun, 09 Jun 2024 07:59:07 -0700 (PDT) Received: from [192.168.18.2] ([107.159.235.98]) by smtp.gmail.com with ESMTPSA id af79cd13be357-795589cc8ccsm117935685a.3.2024.06.09.07.59.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Jun 2024 07:59:07 -0700 (PDT) Message-ID: Date: Sun, 9 Jun 2024 10:59:06 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] function and symbol for headline and olp for org-capture-templates To: Ihor Radchenko References: <42f22002-b17b-40ab-a8de-3a0df5091be9@gmail.com> <87plsvpxh5.fsf@localhost> <87frtpgj2w.fsf@localhost> Content-Language: en-US From: Nafiz Islam Cc: emacs-orgmode@gnu.org In-Reply-To: <87frtpgj2w.fsf@localhost> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2001:4860:4864:20::34; envelope-from=nafiz.islam1000@gmail.com; helo=mail-oa1-x34.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: -9.66 X-Spam-Score: -9.66 X-Migadu-Queue-Id: 49CAB57140 X-Migadu-Scanner: mx13.migadu.com X-TUID: 5hH7c2+Gq6Em > 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 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?