From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id QO1yCgXI3mMpHwEAbAwnHQ (envelope-from ) for ; Sat, 04 Feb 2023 22:03:01 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id kPlSCgXI3mPSVwEAauVa8A (envelope-from ) for ; Sat, 04 Feb 2023 22:03:01 +0100 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 765ED67D0 for ; Sat, 4 Feb 2023 22:03:00 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOPff-00070V-16; Sat, 04 Feb 2023 16:02:03 -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 1pOPfX-0006zl-Uf for emacs-orgmode@gnu.org; Sat, 04 Feb 2023 16:02:00 -0500 Received: from mail-sender-5.unibw-hamburg.de ([139.11.10.105] helo=premail.unibw-hamburg.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOPfV-0003Tu-0a for emacs-orgmode@gnu.org; Sat, 04 Feb 2023 16:01:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hsu-hh.de; s=hsu-hh_de; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=nLHradnefz2e1ggZKklupgQlRvPjLT+4yN6r5BAaEVw=; t=1675544511; x=1676408511; b=Zn2rDrSNkYPajPAxA0LMtRMCDbbfK8QGI3HBx5uaOehrBM29dl2IAjnDCv+s9jA4Uux50MiQJZ7 UQY2tc2cL/QrB9rlFGzMPU9APYoJ3V3ZFW8ZF04zMXbPC09Q20inPd0LSPGZ6B02m8f4tLs6/9TVb HmX9Y9r42QQ/0CMmwJ3omTg90UL68W8jIYK1eBdVMbbqdPc3Jrn5bUDu68UgLq/WXXLx0Aa6AlMvi biaiaFUMT9GXgG/dplSX3sVjhWOaRE1UnpujhPuIV0zrdAwM3vsxk2GaBD2sTFNnooR8xAvj/j0Gp W8r/QtgQFxVqpf3dcGjaXJeUe+964FJX6WDg==; Received: from rzav4.unibw-hamburg.de ([139.11.12.54]:52390) by premail.unibw-hamburg.de with esmtp (HSU Mailserver) (envelope-from ) id 1pOPfV-00041g-Kq for emacs-orgmode@gnu.org; Sat, 04 Feb 2023 22:01:50 +0100 X-IronPort-AV: E=Sophos;i="5.97,272,1669071600"; d="scan'208,223";a="80682985" Received: from mailcluster-1.unibw-hamburg.de (HELO premail.unibw-hamburg.de) ([139.11.5.101]) by rzav4.unibw-hamburg.de with ESMTP; 04 Feb 2023 22:01:50 +0100 Received: from [93.127.239.210] (port=60394 helo=linux.fritz.box) by premail.unibw-hamburg.de with esmtpsa (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (HSU Mailserver) (envelope-from ) id 1pOPfV-0003y3-CN; Sat, 04 Feb 2023 22:01:50 +0100 Date: Sat, 4 Feb 2023 22:01:04 +0100 From: Detlef Steuer To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [patch] improved: add TTL as defcustom to ox-icalendar Message-ID: <20230204220104.2d74cc4e@linux.fritz.box> In-Reply-To: <87leldg00x.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> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.35; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/uOdbtIA9p0PazejZ1aGBEU8" X-HSU-Virusscan: Routed to first Viruswall X-Brisant: Sender steuer@hsu-hh.de X-HSU-Virusscan: First Viruswall passed X-Authenticated-Sender: 13438/93.127.239.210 X-HSU-Virusscan: Routed to second Viruswall (Cisco Ironport ESAV) X-Brisant: Sender steuer@hsu-hh.de Received-SPF: pass client-ip=139.11.10.105; envelope-from=prvs=0399b724c7=steuer@hsu-hh.de; helo=premail.unibw-hamburg.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, 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1675544581; 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=nLHradnefz2e1ggZKklupgQlRvPjLT+4yN6r5BAaEVw=; b=NLzvy7oLbv7ii+5Bu2PXyVJrDHmPWBqqDmLA8v82iDSlx6YRXjWwiP2c1sNr9xjsset2g5 OnMemIih681r08ukp5anZZSP9yH4gO135AfGzc2twMHWb5z1JavZV1IA8deMt+EB8YfoQ6 VBxqvLij9gaMGq9lKZrS1xm95IL/OMZnxXwyxZYnxYXNDt3Y6douKvK2iZO6ekhh9rPyJA SOE3hqPxiF325AzZprP3GeNgvUwtZtiNaU11GBsji7B0+/7vwOoL084RE77ikSzW3OBtJl AGM4NOO1LSNn/oLUinwzNRjvNaag3Fihh8EQVG788/rJtZ1HHx9aJmbHzTyXSg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=hsu-hh.de header.s=hsu-hh_de header.b=Zn2rDrSN; 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=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1675544581; a=rsa-sha256; cv=none; b=cVVQMwPG64O3+yGLIbpejFaf0EJtC9wC02raizpJWv3bQAY++p+6lCM/1nsTcif8jviXbN EmnzE4KuLAMdrs5raTGfJtE0liJQvG16/+KQ87EVMLakbdQOykCBf8/OwwujJh1w7enECp G/3gu25V4oDt/FzdGRK6nmRmlTJAVe+Bt0sNpQMfhqd7RhtyYTnOvuy+Ev9ZOe2ugBmrY4 MgsJF0vzjyGfeBhRFbj2Vt/kA5PNwoeBLBIn08liYzhgUoKMA3e7LIyvH2lcqgRVxeE94L MFbUSfnk4mnv92U1IWJHWuOcTKmQ8Q9ZY8qQYu7xzO/zhqWNpD2bI/+7vS8J4Q== X-Migadu-Spam-Score: -2.28 X-Spam-Score: -2.28 X-Migadu-Queue-Id: 765ED67D0 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=hsu-hh.de header.s=hsu-hh_de header.b=Zn2rDrSN; 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=none X-Migadu-Scanner: scn1.migadu.com X-TUID: 82E1UbnIWzsl --MP_/uOdbtIA9p0PazejZ1aGBEU8 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline > > May you please also take into account the amendments I made in my > patch I attached earlier? For example, you still appear to use > time-to-live and "time to life" inconsistently herein. > Oh, sorry, something went terribly wrong on my end. Next try. Thx for your patience! Detlef --MP_/uOdbtIA9p0PazejZ1aGBEU8 Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-lisp-ox-icalendar.el-Add-defcustom-org-icalendar-ttl.patch >From 43cd5b0ce1fd591a92bb40d52f3dfb3ca5491930 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 defcustom `org-icalendar-ttl' to ox-icalendar * lisp/ox-icalendar.el: The option `org-icalendar-ttl' allows to advise a subscriber to the exported ICS file to reload after the given time interval. 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. --- etc/ORG-NEWS | 17 ++++++++++++++ lisp/ox-icalendar.el | 53 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index c5e9cd568..52c1bae93 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -24,6 +24,23 @@ consider [[https://gitlab.com/jackkamm/ob-python-mode-mode][ob-python-mode-mode] has been ported to. ** 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. + *** ~org-clock-x11idle-program-name~ now defaults to =xprintidle=, when available When =xprintidle= executable is available at =org-clock= load time, it diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el index 81a77a770..9651c74a0 100644 --- a/lisp/ox-icalendar.el +++ b/lisp/ox-icalendar.el @@ -295,7 +295,31 @@ Interesting value are: (const :tag "Local time" ":%Y%m%dT%H%M%S") (const :tag "Explicit local time" ";TZID=%Z:%Y%m%dT%H%M%S") (const :tag "Universal time" ":%Y%m%dT%H%M%SZ") - (string :tag "Explicit format"))) + (string :tag "Other"))) + +(defcustom org-icalendar-ttl "PT1H" + "The 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 a client is +the nextcloud calendar, which respects the setting of +X-PUBLISHED-TTL in an ICS file. 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 possiblee values of this option. For example +\"PT1H\" stands for 1 hour, \"PT0H27M34S\" stands for 0 hours, 27 minutes +and 34 seconds. Default value is nil, which means no such option +is set in the ICS file. + +This option can also be set with the ICAL-TTL keyword." + :group 'org-export-icalendar + :type '(choice + (const :tag "no refresh" nil) + (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. @@ -333,6 +357,7 @@ re-read the iCalendar file.") (:icalendar-timezone nil nil org-icalendar-timezone) (:icalendar-use-deadline nil nil org-icalendar-use-deadline) (:icalendar-use-scheduled nil nil org-icalendar-use-scheduled) + (:icalendar-ttl "ICAL-TTL" nil org-icalendar-ttl) (:icalendar-scheduled-summary-prefix nil nil org-icalendar-scheduled-summary-prefix) (:icalendar-deadline-summary-prefix nil nil org-icalendar-deadline-summary-prefix)) :filters-alist @@ -872,24 +897,29 @@ as a communication channel." (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, the time-to-live resp. refresh period and +the other components included." (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" - (org-icalendar-cleanup-string name) - (org-icalendar-cleanup-string owner) - (org-icalendar-cleanup-string tz) - (org-icalendar-cleanup-string description)) +X-WR-CALDESC:%s\n" +(when ttl "X-PUBLISHED-TTL:%s\n") +"CALSCALE:GREGORIAN\n") + (org-icalendar-cleanup-string name) + (org-icalendar-cleanup-string owner) + (org-icalendar-cleanup-string tz) + (org-icalendar-cleanup-string description) + (org-icalendar-cleanup-string ttl)) contents "END:VCALENDAR\n")) @@ -1018,6 +1048,7 @@ This function assumes major mode for current buffer is user-full-name (or (org-string-nw-p org-icalendar-timezone) (format-time-string "%Z")) org-icalendar-combined-description + org-icalendar-ttl contents))) (run-hook-with-args 'org-icalendar-after-save-hook file))) @@ -1042,6 +1073,8 @@ FILES is a list of files to build the calendar from." (format-time-string "%Z")) ;; Description. org-icalendar-combined-description + ;; TTL (Refresh period) + org-icalendar-ttl ;; Contents. (concat ;; Agenda contents. -- 2.39.1 --MP_/uOdbtIA9p0PazejZ1aGBEU8--