From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id iAPGFy+OtGVKNQEAqHPOHw:P1 (envelope-from ) for ; Sat, 27 Jan 2024 06:01:35 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id iAPGFy+OtGVKNQEAqHPOHw (envelope-from ) for ; Sat, 27 Jan 2024 06:01:35 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hAvzqdwP; 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=1706331695; 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=ZoDn/Oy5kKXtwrn06eiKnMhaQcGzx1f0QI4dKdeTaWM=; b=t2/xBoqtNjwYVKI5kJeY2PKDQfMOBKkdrHux31yB57wYBNM0xRf8akqvdKjnnRD8UERjp7 l9VBwMbyk+8SAJiTf+oyCIWXY28gi6Zqow5cmfT82fRjfBnvSo6oN25+9rgeGWxPVpx3L4 BJWdzts204cSc5pCN3h9KBhuf2m64LKJMAELq1hyLucPUQlrOZi+8W6PyXf+LGjPAs1x1T aJhunr7TkSoF9nv0itD3F+Q07JgFBDGuyOVqnyNOW4PD3O8KWpba1p6I8/KW1iobqf2oFv S3XVtjzv7Kt3mJ+5c7mpn63cTONl5LNsvSq0cKEj+vGkJMZaVt4qv3FnQhJfgg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hAvzqdwP; 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-Seal: i=1; s=key1; d=yhetil.org; t=1706331695; a=rsa-sha256; cv=none; b=pnvXwbF4tOJ0Dtf3tN0YTMOENhFjEIUCkI+ZyFCqa7/CJS5FvKEWUdLi0gcykYEQM4OBR7 YJDiw9o1Bqovm97GVqPgujtvlX108dhLhonyQ3PDZbUuBS/IqArX2dMBBpmcwShKo8j5Oj RGKVCIEZV5DVw67CYcngXABnzd1Z3C4zSSwQ6NHbHXWU4ESFU5kbjpnm7nwI5PvDOyfsr9 K5Pb3pluP9ghMnLKVnn5cz9UlrzYbVXwJ2KKvUmt1fNeRh7B1Dy6pS+YLUTX0oCBvs2CIc NKYIsGeLV5bxPXaOElykja3H/oKKeSQEZGuulkrxNVYxWdBodSnNaENztFNRUw== 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 10A733095A for ; Sat, 27 Jan 2024 06:01:35 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTaoQ-0003TZ-Kg; Sat, 27 Jan 2024 00:01:02 -0500 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 1rTaoO-0003TO-8b for emacs-orgmode@gnu.org; Sat, 27 Jan 2024 00:01:00 -0500 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rTaoM-00039s-2t for emacs-orgmode@gnu.org; Sat, 27 Jan 2024 00:00:59 -0500 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1d76671e5a4so8941165ad.0 for ; Fri, 26 Jan 2024 21:00:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706331656; x=1706936456; darn=gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ZoDn/Oy5kKXtwrn06eiKnMhaQcGzx1f0QI4dKdeTaWM=; b=hAvzqdwPRplkEd83dBO8X3pzm/JFvV9YnFlV8lfy3mbZmO1B7jVh4AMRIlwOhAxIcp hUqnunXHVLzs6IaonRbXS4CffbjBxnaqtqFLMe7A3dTvrlFFeD6dPGp9gfOwgACHnu+B PqDr942S5nrzOFgd+OtHcxnDroGH5eC59XWlvf53t+Mmhwvshs5RIPXhSMKn6U1MH9nr 50/5hgkAo3olJMLgicJl9cqQKEEmqqQ0LxnEUQCdkLF1Eo7AQn+Ubzjcl+o+2lZC3AjS ZLgDgzFCOOXwJOgPjvAs946M44n5QQHEVScWrregrqfC8r9jTy7U8ff/rDS+LQ72qTLh ldnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706331656; x=1706936456; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZoDn/Oy5kKXtwrn06eiKnMhaQcGzx1f0QI4dKdeTaWM=; b=Fo8M50yhCGv5vjqAg81sL1TUAi2kanZGJnFBXIsjqbWGKCGFGxwaZpN7jeW1pX0ec+ rVw8/qb4ujK+BD754zkMMkmsX9JnTDqC/HWiLatKJrmExUOgML0VPj9FS5lwuHVWZHEf fz+SO2NDNGmqu4Of2oxULiPhr9Kiv1P/8y9rSQ0FDLgQS0ED5mtqZix7PL98PSWSoiOC DF/Qs3Oy37UbpSJi7RFlYrOnqjUnfSrTrycfpthh91qS2mSkQvdgkWpU2tIgjPxQKFC6 qcV1ypGSfNudBYfFdCiX5uAY812Wr+YpQjNY2ZXgBvuB5ZE4HCjH71DZ58a3A6j58U81 e9eg== X-Gm-Message-State: AOJu0YyHc7KghsbBLU6ExGQxTLK10EmteflJcDztoBipgcRXNNZNs2BL hXZr1pZdJbxAH2/9gJZCVZiHXt1OiaePuS7SXq5QYLb+QrMSvN0O X-Google-Smtp-Source: AGHT+IF/xr4t0DAegt0REJu+PaVV1/Ayxi4jwcM2JiUCTcNW9wPufPBLdsop8/njTfbineMFxUFUQQ== X-Received: by 2002:a17:902:dacb:b0:1d3:3a82:a836 with SMTP id q11-20020a170902dacb00b001d33a82a836mr1028727plx.51.1706331656021; Fri, 26 Jan 2024 21:00:56 -0800 (PST) Received: from localhost (157-131-78-143.fiber.dynamic.sonic.net. [157.131.78.143]) by smtp.gmail.com with ESMTPSA id nc13-20020a17090b37cd00b002927a36b7a0sm1988465pjb.23.2024.01.26.21.00.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 21:00:54 -0800 (PST) From: Jack Kamm To: Ihor Radchenko , Detlef Steuer Cc: emacs-orgmode@gnu.org Subject: Re: [patch] improved: add TTL as defcustom to ox-icalendar In-Reply-To: <87fsbke5ce.fsf@localhost> References: <20211230225919.1a660666@hsu-hh.de> <20220102142849.0af72bcb@hsu-hh.de> <20220103084141.72d2f384@hsu-hh.de> <20220103123253.6bb48655@hsu-hh.de> <87o7tgaa42.fsf@localhost> <20221109082520.066dc4c6@linux.fritz.box> <20230113181035.1469ab37@hsu-hh.de> <878ri52z06.fsf@localhost> <20230116234230.5080fb07@linux.fritz.box> <87lem1ijih.fsf@localhost> <20230117110316.56a1899e@gaia.unibw-hamburg.de> <87a62hihcg.fsf@localhost> <20230203142508.4140679f@linux.fritz.box> <87leldg00x.fsf@localhost> <20230204220104.2d74cc4e@linux.fritz.box> <87fsbke5ce.fsf@localhost> Date: Fri, 26 Jan 2024 21:00:53 -0800 Message-ID: <877cjv9xq2.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=jackkamm@gmail.com; helo=mail-pl1-x62e.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, 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.97 X-Spam-Score: -9.97 X-Migadu-Queue-Id: 10A733095A X-Migadu-Scanner: mx12.migadu.com X-TUID: sIqGa6W3ciqc --=-=-= Content-Type: text/plain Ihor Radchenko writes: > This does not look right. Did you try to export anything with this patch > applied? You are passing multiple string arguments to `format'. > > Finally, I think that we can document the new keyword in the manual. I've updated the patch so that it applies cleanly onto the latest main, and also fixed a few issues including the ones Ihor pointed out above. Let me know if there are any issues -- otherwise I'll apply it to main in the near future. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-lisp-ox-icalendar.el-Add-time-to-live-functionality-.patch >From 24a6bc78c74d16a6aa7dbd081be9f626b20bbf20 Mon Sep 17 00:00:00 2001 From: Detlef Steuer Date: Sat, 4 Feb 2023 21:40:09 +0100 Subject: [PATCH] lisp/ox-icalendar.el: Add time-to-live functionality to ox-icalendar This commit adds functionality for ox-icalendar to set X-PUBLISHED-TTL in the exported ICS, which advises a subscriber to the exported ICS file to reload after the given time interval. * lisp/ox-icalendar.el (org-icalendar-ttl): New option to set X-PUBLISHED-TTL in exported ICS (icalendar): Add ICAL-TTL export keyword (org-icalendar--vcalendar): Add argument for TTL (org-icalendar-template, org-icalendar-export-current-agenda, org-icalendar--combine-files): Pass TTL to `org-icalendar--vcalendar' Co-authored-by: Ihor Radchenko Co-authored-by: Jack Kamm --- doc/org-manual.org | 9 +++++++++ etc/ORG-NEWS | 17 ++++++++++++++++ lisp/ox-icalendar.el | 47 ++++++++++++++++++++++++++++++++++++++------ 3 files changed, 67 insertions(+), 6 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index 7e5ac0673..8fe79ee45 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -16369,6 +16369,15 @@ information. The iCalendar standard defines three visibility classes: The server should treat unknown class properties the same as =PRIVATE=. +#+cindex: @samp{ICAL-TTL}, keyword +#+vindex: org-icalendar-ttl +The exported iCalendar file can advise clients how often to check for +updates. This duration can be set globally with the +~org-icalendar-ttl~ variable, or on a per-document basis with the +=ICAL-TTL= keyword. This option should be set using the iCalendar +notation for time durations; consult the docstring of +~org-icalendar-ttl~ for more details. + Exporting to iCalendar format depends in large part on the capabilities of the destination application. Some are more lenient than others. Consult the Org mode FAQ for advice on specific diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 1bf7eb5b4..5a93788e9 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -424,6 +424,23 @@ The change is breaking when ~org-use-property-inheritance~ is set to ~t~. The =TEST= parameter is better served by Emacs debugging tools. ** New and changed options +*** New custom setting ~org-icalendar-ttl~ for the ~ox-icalendar~ backend + +The option ~org-icalendar-ttl~ allows to advise a subscriber to the +exported =.ics= file to reload after the given time interval. + +This is useful i.e. if a calendar server subscribes to your exported +file and that file is updated regularly. + +See IETF RFC 5545, Section 3.3.6 Duration and +https://en.wikipedia.org/wiki/ICalendar#Other_component_types for +details. + +Default for ~org-icalendar-ttl~ is ~nil~. In that case the setting +will not be used in the exported ICS file. + +The option may also be set using the =ICAL-TTL= keyword. + *** The default value of ~org-attach-store-link-p~ is now ~attached~ Now, after attaching a file, =[[attach:...]]= link to the attached file diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el index cb416a68f..584c78fcf 100644 --- a/lisp/ox-icalendar.el +++ b/lisp/ox-icalendar.el @@ -331,6 +331,32 @@ (defcustom org-icalendar-date-time-format ":%Y%m%dT%H%M%S" (const :tag "Universal time" ":%Y%m%dT%H%M%SZ") (string :tag "Explicit format"))) +(defcustom org-icalendar-ttl nil + "Time to live for the exported calendar. + +Subscribing clients to the exported ics file can derive the time +interval to read the file again from the server. One example of such +client is Nextcloud calendar, which respects the setting of +X-PUBLISHED-TTL in ICS files. Setting `org-icalendar-ttl' to \"PT1H\" +would advise a server to reload the file every hour. + +See https://icalendar.org/iCalendar-RFC-5545/3-8-2-5-duration.html +for a complete description of possible specifications of this +option. For example, \"PT1H\" stands for 1 hour and +\"PT0H27M34S\" stands for 0 hours, 27 minutes and 34 seconds. + +The default value is nil, which means no such option is set in +the ICS file. This option can also be set on a per-document basis +with the ICAL-TTL export keyword." + :group 'org-export-icalendar + :type '(choice + (const :tag "No refresh period" nil) + (const :tag "One hour" "PT1H") + (const :tag "One day" "PT1D") + (const :tag "One week" "PT7D") + (string :tag "Other")) + :package-version '(Org . "9.7")) + (defvar org-icalendar-after-save-hook nil "Hook run after an iCalendar file has been saved. This hook is run with the name of the file as argument. A good @@ -368,7 +394,8 @@ (org-export-define-derived-backend 'icalendar 'ascii (:icalendar-use-deadline nil nil org-icalendar-use-deadline) (:icalendar-use-scheduled nil nil org-icalendar-use-scheduled) (:icalendar-scheduled-summary-prefix nil nil org-icalendar-scheduled-summary-prefix) - (:icalendar-deadline-summary-prefix nil nil org-icalendar-deadline-summary-prefix)) + (:icalendar-deadline-summary-prefix nil nil org-icalendar-deadline-summary-prefix) + (:icalendar-ttl "ICAL-TTL" nil org-icalendar-ttl)) :filters-alist '((:filter-headline . org-icalendar-clear-blank-lines)) :menu-entry @@ -1021,25 +1048,30 @@ (defun org-icalendar-template (contents info) (or (org-string-nw-p org-icalendar-timezone) (format-time-string "%Z")) ;; Description. (org-export-data (plist-get info :title) info) + ;; TTL + (plist-get info :icalendar-ttl) contents)) -(defun org-icalendar--vcalendar (name owner tz description contents) +(defun org-icalendar--vcalendar (name owner tz description ttl contents) "Create a VCALENDAR component. -NAME, OWNER, TZ, DESCRIPTION and CONTENTS are all strings giving, +NAME, OWNER, TZ, DESCRIPTION, TTL and CONTENTS are all strings giving, respectively, the name of the calendar, its owner, the timezone -used, a short description and the other components included." +used, a short description, time to live (refresh period) and +the other components included." (org-icalendar-fold-string (concat (format "BEGIN:VCALENDAR VERSION:2.0 X-WR-CALNAME:%s PRODID:-//%s//Emacs with Org mode//EN X-WR-TIMEZONE:%s -X-WR-CALDESC:%s -CALSCALE:GREGORIAN\n" +X-WR-CALDESC:%s\n" (org-icalendar-cleanup-string name) (org-icalendar-cleanup-string owner) (org-icalendar-cleanup-string tz) (org-icalendar-cleanup-string description)) + (when ttl (format "X-PUBLISHED-TTL:%s\n" + (org-icalendar-cleanup-string ttl))) + "CALSCALE:GREGORIAN\n" contents "END:VCALENDAR\n"))) @@ -1167,6 +1199,7 @@ (defun org-icalendar-export-current-agenda (file) user-full-name (or (org-string-nw-p org-icalendar-timezone) (format-time-string "%Z")) org-icalendar-combined-description + org-icalendar-ttl contents))) (org-icalendar--post-process-file file))) @@ -1191,6 +1224,8 @@ (defun org-icalendar--combine-files (&rest files) (format-time-string "%Z")) ;; Description. org-icalendar-combined-description + ;; TTL (Refresh period) + org-icalendar-ttl ;; Contents. (concat ;; Agenda contents. -- 2.43.0 --=-=-=--