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 ms13.migadu.com with LMTPS id gOzVK0d+5mYfdQEAe85BDQ:P1 (envelope-from ) for ; Sun, 15 Sep 2024 06:27:19 +0000 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 gOzVK0d+5mYfdQEAe85BDQ (envelope-from ) for ; Sun, 15 Sep 2024 08:27:19 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aRkO2NeG; dmarc=pass (policy=none) header.from=gmail.com; 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=1726381639; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=xF/ir3wyyaGGoE7cXvyvjar2QummZYzyhZ9Dii8oNSE=; b=CEefCVU3/Ina32SNRgPqTrTkXXIxiq9BBMbdg4neYMPQ/pfzwmSA55WCwjcy3Mr0om1t4R kdKZQKNs4fgqJkLMOGYlSfjhD0VeCJ59SCBbzAiM6kv+xeJHAoxqpWUs/kx8LUep7j3llg fTIz1kC2PS9Q9dw6nRwcRb08yNLNuT9X2OeoGf1dkEFEiguidZVU5q//hPXXAzpagBS9oG JovFozf8RdC0izzFX6hvAU4sDxBn8QDdxxWfMQo7ItofvyE+wTAL7Hx+EYzl9tzh/o1uBi PlV2PawnzuOc1MK8FgspJcSMhBPUlAx0jUs+V7ANC4lH+QCqeuydaJ+8LlUhTw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1726381639; a=rsa-sha256; cv=none; b=i9ZA+SBXGGDB/eOrcCvGuH1AAQp+vTNiKi/nez65sERz/MT/3U/M74HqgG4k+bXcznDoX+ RazdjVK0ecxLqvUj+ZY9EwROT49opXn+ImcPr15wTEX93gDtEPs5Xf91gCeltlq3G4zaSR JwcLtlN8d5d4N+dP9Joeez0Z3yVtAXXFAZo6HCz+gc2NZX5xFHZyHyMJpLRC02IbiE2T/3 f0lHWHaxMX3Sl/Bk8/xiIYAPQkuJadDB3Bh3ssAdgYu4cYixeFs3GC4HcllZQ6UiauQnNm 3EwGlDgi4InIWQnBsXxkLzsvyojF+CRrvornEDECRsztyCVMmQs1Hs40FK+nlg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aRkO2NeG; dmarc=pass (policy=none) header.from=gmail.com; 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 5A938709D7 for ; Sun, 15 Sep 2024 08:27:19 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1spiiA-00078C-4F; Sun, 15 Sep 2024 02:26:18 -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 1spii4-00077W-V3 for emacs-orgmode@gnu.org; Sun, 15 Sep 2024 02:26:14 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1spii3-00077J-5A for emacs-orgmode@gnu.org; Sun, 15 Sep 2024 02:26:12 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-2057c6c57b5so20592355ad.1 for ; Sat, 14 Sep 2024 23:26:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726381568; x=1726986368; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=xF/ir3wyyaGGoE7cXvyvjar2QummZYzyhZ9Dii8oNSE=; b=aRkO2NeGQPXQw+WYoxxHWFXnlkj2UwuaWvDCwZKc7232WCTka9AoT8VsYI+jmT/W0f B7VSm/Zle1pFvi7ZKwvlCeiBMtNNoAUbMhYxpcMpzpDOrBlkYOxhYW/WqW6KJi9S9P8E +8WPu41tPj2bSKWBNSam316EaZEAqsHJo9AdxwXz9oktMD+v9xeWqGBDuEPzgHCnlW06 gCN+nASR5FTXmYg5RfRD0WR5MDz2V2NFeQAqTEG5xT9v+vRk6VsIHYEtCfx9L69Ule96 AR+1OiTk/JlaiaZX6/Fy0ecSUS41JUMM6iplhevUkkNyw24rwe4JIC1KhcOzjxuYSar5 Ircw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726381568; x=1726986368; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=xF/ir3wyyaGGoE7cXvyvjar2QummZYzyhZ9Dii8oNSE=; b=QTuqmGXxvuTQn3fQC4TvTYL4ri+6B4vD96EZulvi6jUY9x3r/6eouzHTzHZ3mSFc0t +Or0E06IuKRMzqRVYSZIblPxbP3yzrLY0nB5JaA53i2ArF0xb9+101cKImy+5SLfeKGc OSpA+YIYSEMVyOE9wKKRfi16+iGib3lLWuXe21Q2G9ivGA0WdEQC0IvkqQLhw7nK9Hzg wH/6cR8VdN2ifiXYAggam/U3bc2fpD7jLPx0puv8ohJ6+67FWgq51fpDnEpDUQfIdh0m ZI7FjxDeSM8pJS7oTWVztYfsLvC8TIutSDJHgNPJPhAwwT+q0FRZFCKWNVHNIJ2pLrFH S/+Q== X-Gm-Message-State: AOJu0YzFV+kiULQa5IXq7EmbgM7fHJwAPtzSGhP7+SDQEc83rgLqEexh 9stWtS/V8ygcfL6RNO7inm/fKrftuqQPKH6D19TF8joeExLwvOp6lsAB7g== X-Google-Smtp-Source: AGHT+IEWrjh2tjnT6NVD8lYhYmzGtl9dtJEQmxgXEt7FeFIi7n2JQmMyYxN6nKK8Kc2eIc4+UwWM9w== X-Received: by 2002:a17:902:c947:b0:206:955c:67be with SMTP id d9443c01a7336-2074c5eea5cmr273003265ad.9.1726381567884; Sat, 14 Sep 2024 23:26:07 -0700 (PDT) Received: from localhost ([198.27.183.102]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-207946032aesm17318765ad.67.2024.09.14.23.26.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Sep 2024 23:26:07 -0700 (PDT) From: Jack Kamm To: emacs-orgmode@gnu.org Subject: [PATCH] Fix ox-icalendar export of diary timestamps Date: Sat, 14 Sep 2024 23:26:06 -0700 Message-ID: <87y13tqvpd.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=jackkamm@gmail.com; helo=mail-pl1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -5.61 X-Spam-Score: -5.61 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Queue-Id: 5A938709D7 X-TUID: dwi9qSTLnE90 --=-=-= Content-Type: text/plain ox-icalendar skips the following event with a diary timestamp during export: * First Sunday of the month <%%(diary-float t 0 1)> ox-icalendar actually has longstanding code to handle diary timestamps [1], but that code path is not reached, in part because `org-export--skip-p' always skips timestamps with type `diary'. The attached patch fixes this by including diary timestamps when the export option `:with-timestamps' is `active'. I think it's reasonable to consider diary timestamps as a type of active timestamp during export, since they are included in the agenda, and have angle brackets. [1] https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/ox-icalendar.el?id=07dd3bcae6b7b5e0692fc40dd307a7e841179b52#n826 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-ox-icalendar-Fix-export-of-diary-style-timestamps.patch >From 32a5afd2803aa54e1e21b11d9d1e832e99538e9b Mon Sep 17 00:00:00 2001 From: Jack Kamm Date: Sat, 14 Sep 2024 22:48:44 -0700 Subject: [PATCH] ox-icalendar: Fix export of diary-style timestamps * lisp/ox-icalendar.el (org-icalendar-entry): Include timestamps of type diary when `:with-timestamps' is `active'. * lisp/ox.el (org-export--skip-p): Include timestamps of type diary when `:with-timestamps' is `active'. * testing/lisp/test-ox-icalendar.el (test-ox-icalendar/diary-timestamp): Unit test for exporting timestamps of type diary. --- lisp/ox-icalendar.el | 2 +- lisp/ox.el | 2 +- testing/lisp/test-ox-icalendar.el | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el index 858d146d6..e7ca6aafb 100644 --- a/lisp/ox-icalendar.el +++ b/lisp/ox-icalendar.el @@ -746,7 +746,7 @@ (defun org-icalendar-entry (entry contents info) (lambda (ts) (when (let ((type (org-element-property :type ts))) (cl-case (plist-get info :with-timestamps) - (active (memq type '(active active-range))) + (active (memq type '(active active-range diary))) (inactive (memq type '(inactive inactive-range))) ((t) t))) (let ((uid (format "TS%d-%s" (cl-incf counter) uid))) diff --git a/lisp/ox.el b/lisp/ox.el index 7a0ab4dc7..79a1f5cfb 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -1857,7 +1857,7 @@ (defun org-export--skip-p (datum options selected excluded) (cl-case (plist-get options :with-timestamps) ((nil) t) (active - (not (memq (org-element-property :type datum) '(active active-range)))) + (not (memq (org-element-property :type datum) '(active active-range diary)))) (inactive (not (memq (org-element-property :type datum) '(inactive inactive-range))))))))) diff --git a/testing/lisp/test-ox-icalendar.el b/testing/lisp/test-ox-icalendar.el index e631b2119..c7c74c526 100644 --- a/testing/lisp/test-ox-icalendar.el +++ b/testing/lisp/test-ox-icalendar.el @@ -128,5 +128,20 @@ (ert-deftest test-ox-icalendar/warn-unsupported-repeater () (when (file-exists-p tmp-ics) (delete-file tmp-ics)))))))) +(ert-deftest test-ox-icalendar/diary-timestamp () + "Test icalendar export of diary timestamps." + (let* ((tmp-ics (org-test-with-temp-text-in-file + "* First Sunday of the month +<%%(diary-float t 0 1)>" + (expand-file-name (org-icalendar-export-to-ics))))) + (unwind-protect + (with-temp-buffer + (insert-file-contents tmp-ics) + (save-excursion + (should (search-forward "SUMMARY:First Sunday of the month"))) + (save-excursion + (should (search-forward "RRULE:FREQ=MONTHLY;BYDAY=1SU")))) + (when (file-exists-p tmp-ics) (delete-file tmp-ics))))) + (provide 'test-ox-icalendar) ;;; test-ox-icalendar.el ends here -- 2.46.0 --=-=-=--