From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id kCTcLSrTxWPfVwAAbAwnHQ (envelope-from ) for ; Mon, 16 Jan 2023 23:43:54 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id oNrZLSrTxWNt3QAA9RJhRA (envelope-from ) for ; Mon, 16 Jan 2023 23:43:54 +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 1BC343AB8D for ; Mon, 16 Jan 2023 23:43:54 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHYCA-0006Rp-Is; Mon, 16 Jan 2023 17:43:16 -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 1pHYC8-0006RZ-D5 for emacs-orgmode@gnu.org; Mon, 16 Jan 2023 17:43:12 -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 1pHYC4-00029h-Q7 for emacs-orgmode@gnu.org; Mon, 16 Jan 2023 17:43:11 -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=AwfsD5+j1zkSAnIyKihG+9/JM2GoutCl7OKf+btg4MY=; t=1673908987; x=1674772987; b=JpYOFmwHpK60yyl3lGJaZQ/rlw2WGdkkIemJ7dQs5ykVk88MwU1St5r6KeYRbxuMjoNbBwdNuH8 qGcp03848t/cx0UDg2U8V5D+utlITbM/vAxwNiAh2AL3gsEtR/ePFCmUV7+McV3Ce8y1SwE9u4qRK dRJrPWOHhs8BT3pb3uI3c9Di9Vi9dpt2rFCDZhkaA8fdm4fb5TAMnjji6LqAJkS8OJNRkYj8qwAJj mHzd5sGbrEe5qPHzO49VUXQyhU+1BKqhN3CYKiy0z9Og7qjt8h6/6BWu3C5fKN/+vuCHp47N5s+lr 6FQ4e9B5yBfkh7nQuvOs+8NRIFpAdsonZkMQ==; Received: from rzav4.unibw-hamburg.de ([139.11.12.54]:36260) by premail.unibw-hamburg.de with esmtp (HSU Mailserver) (envelope-from ) id 1pHYCC-0002lb-Ic for emacs-orgmode@gnu.org; Mon, 16 Jan 2023 23:43:05 +0100 X-IronPort-AV: E=Sophos;i="5.97,222,1669071600"; d="scan'208,223";a="80210775" Received: from mailcluster-1.unibw-hamburg.de (HELO premail.unibw-hamburg.de) ([139.11.5.101]) by rzav4.unibw-hamburg.de with ESMTP; 16 Jan 2023 23:43:06 +0100 Received: from [212.53.243.31] (port=34634 helo=linux.fritz.box) by premail.unibw-hamburg.de with esmtpsa (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (HSU Mailserver) (envelope-from ) id 1pHYCC-0002dI-9G; Mon, 16 Jan 2023 23:43:05 +0100 Date: Mon, 16 Jan 2023 23:42:30 +0100 From: Detlef Steuer To: emacs-orgmode@gnu.org Cc: Ihor Radchenko Subject: Re: [patch] improved: add TTL as defcustom to ox-icalendar Message-ID: <20230116234230.5080fb07@linux.fritz.box> In-Reply-To: <878ri52z06.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> 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_/q95A3a3FNLB00dAneHY9pU9" X-HSU-Virusscan: Routed to first Viruswall X-Brisant: Sender steuer@hsu-hh.de X-HSU-Virusscan: First Viruswall passed X-Authenticated-Sender: 13438/212.53.243.31 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=038065b3b1=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-Seal: i=1; s=key1; d=yhetil.org; t=1673909034; a=rsa-sha256; cv=none; b=EwbWKrRnqCgcAgMMf52hSvqJTNhs+ep/k/MZ+g28hLZQuxZtrlrPLd/M4tK/5EpMuX2C1W x6X62vPiytR5VpbVOV/r5GedNeIzCo8mRfJfb1kOGHxIA4HkgUuTfkMSAm2TyUtefbbV7o IKZbXjs2/ppt5BxsoYOgiOjwdT1mBxyTiBFzRiSJEuMwFeSJCwq0f/ZYE1zPblwhDWlWbW Y7XcOKm/Qb3Pt6t5Cs+Iq55onStKGIiHNIvSYV7ZOHafztK9Z5nf/Q57Zp1w6zpmgBqmSL jC8BMeHvZ46R0WROlwtBDHGljIEsinznGsodhzYX8eHOp2jMNOhMJqeEbDQc3A== 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=JpYOFmwH; 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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1673909034; 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=AwfsD5+j1zkSAnIyKihG+9/JM2GoutCl7OKf+btg4MY=; b=YOHfK+H0Rl8IAOF2nig0Ii9pq4PXd4PfFZ9VfrBtxhbKZLGJUkMDqpFz44jtqeYy2FlpAT /dhAuuSWGVGn03GAbj0Efm04o7ANDd7ufnwTJNzi54S7MfbzFciPTlUBToU3dEjdVS7F4N HDx3WCr3c0T3/gBZZn5T5sxFb0k9XaTxOJTQnxRb9TcdZ4uckFLb8WAHs18YH4KzXu+8yz 6+I0R2bgTqx1Z363YsiqkXbxdA3X5HPJGgmgR2MZuX51yEYdIwwr9fx2oNcE/inirAWzR9 1xOVDaClwrGAvM5DGnWp9dlAFyijx7Y4+kqd7aJ0sV1aAx+ucawyd+r4aeCbEw== X-Migadu-Spam-Score: -0.83 X-Spam-Score: -0.83 X-Migadu-Queue-Id: 1BC343AB8D X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=hsu-hh.de header.s=hsu-hh_de header.b=JpYOFmwH; 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-TUID: XgIEkn/oXfZd --MP_/q95A3a3FNLB00dAneHY9pU9 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Ihor! I tried to follow your advice to improve the patch accordingly. New version attached. Detlef Am Sat, 14 Jan 2023 10:26:17 +0000 schrieb Ihor Radchenko : > Detlef Steuer writes: > > > I now finally followed your advice for that patch. > > > > Attached a diff against a clean git checkout from two > > hours ago. > > Thanks! > Rather than diff, it would help to format a proper patch with author > info and commit message (if you can). > See https://orgmode.org/worg/org-contribute.html#first-patch and > https://orgmode.org/worg/org-contribute.html#commit-messages > > > (I send it privately, because I'm such a noob regarding elisp...) > > Do not be afraid to post on the mailing list in future. > We do not shame anyone or attack in any other way. See > https://www.gnu.org/philosophy/kind-communication.html > > If there are problems with the code, we will help to improve them. If > the problems are also discussed in public, other people will have a > chance to learn as well. > > Let me know if you still prefer private communication. > > > > > mail: steuer@hsu-hh.de > > commit e7574a8d429634112a2eb622759b4eef670ee44c > > Author: Detlef Steuer > > Date: Fri Jan 13 17:55:57 2023 +0100 > > > > Add variable org-icalendar-ttl to ox-icalendar.el > > See https://orgmode.org/worg/org-contribute.html#commit-messages for > our preferred commit message format. > > > +(defcustom org-icalendar-ttl nil > > + "The time to life 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 > > Elisp convention is to use double space (" ") between sentences in > docstrings. > > > +the nextcloud calendar, which respects the setting of > > +X-PUBLISHED-TTL, i.e. X-PUBLISHED-TTL:PT1H . > > +See https://icalendar.org/iCalendar-RFC-5545/3-8-2-5-duration.html > > +for a complete description of possiblee values of this option. I.e. > > +PT1H stands for 1 hour, PT0H27M34S for 0 hours, 27 minutes and 34 > > seconds." > > + :group 'org-export-icalendar > > + :type '(choice > > + (const :tag "no refresh" nil) > > + (const :tag "One day" "PT1D") > > + (const :tag "One week" "PT7D") > > + (string :tag "Explizit format"))) > > Maybe just "Other"? > > Also, please add > > :package-version '(Org . "9.7") > > to indicate when the new customization is introduced. > > Finally, please document the new feature in etc/ORG-NEWS file. > > > - (:icalendar-deadline-summary-prefix nil nil > > org-icalendar-deadline-summary-prefix)) > > + (:icalendar-deadline-summary-prefix nil nil > > org-icalendar-deadline-summary-prefix) > > + (:icalendar-ttl nil nil org-icalendar-ttl)) > > > :filters-alist > > '((:filter-headline . org-icalendar-clear-blank-lines)) > > :menu-entry > > @@ -872,24 +889,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 > > + org-icalendar-ttl > > Please use (plist-get info :icalendar-ttl) here and later rather than > the variable. It will then integrate better with Org's export system. > > > respectively, the name of the calendar, its owner, the timezone > > -used, a short description and the other components included." > > - (concat (format "BEGIN:VCALENDAR > > +used, a short description, the time-to-live resp. refresh period > > and > > "time-to-life"? or maybe "time to life"? > --MP_/q95A3a3FNLB00dAneHY9pU9 Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-lisp-ox-icalendar.el-Add-customize-option-org-icalen.patch >From 7ad4b2df9609fd5893e71836aa2e172023fe2895 Mon Sep 17 00:00:00 2001 From: Detlef Steuer Date: Mon, 16 Jan 2023 23:27:33 +0100 Subject: [PATCH] lisp/ox-icalendar.el: Add customize option `org-icalendar-ttl' * ox-icalendar.el: New option `org-icalendar-ttl' to add en entry for the X-PUBLISHED-TTL option to ox-icalendar. Default value is nil, what means no such entry is exported. If non nil the value must be formated according to https://icalendar.org/iCalendar-RFC-5545/3-8-2-5-duration.html. --- etc/ORG-NEWS | 15 +++++++++++++++ lisp/ox-icalendar.el | 45 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 52 insertions(+), 8 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index c5d9bdf6e..47d808df2 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -13,6 +13,21 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org. * Version 9.7 (not released yet) ** New 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 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. + *** New options for the "csl" citation export processor's LaTeX output The ~org-cite-csl-latex-label-separator~ and diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el index 81a77a770..a116ba231 100644 --- a/lisp/ox-icalendar.el +++ b/lisp/ox-icalendar.el @@ -297,6 +297,26 @@ Interesting value are: (const :tag "Universal time" ":%Y%m%dT%H%M%SZ") (string :tag "Explicit format"))) +(defcustom org-icalendar-ttl nil + "The time to life 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 possible specifications 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." + :group 'org-export-icalendar + :type '(choice + (const :tag "no refresh" nil) + (const :tag "One day" "PT1D") + (const :tag "One week" "PT7D") + (string :tag "Explizit format")) + :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 @@ -334,7 +354,8 @@ re-read the iCalendar file.") (: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 nil nil org-icalendar-ttl)) :filters-alist '((:filter-headline . org-icalendar-clear-blank-lines)) :menu-entry @@ -872,24 +893,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." - (concat (format "BEGIN:VCALENDAR +used, a short description, the time-to-live resp. refresh period and +the other components included." + (concat (format (concat "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" +(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 description) + (org-icalendar-cleanup-string ttl)) contents "END:VCALENDAR\n")) @@ -1018,6 +1044,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 +1069,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.0 --MP_/q95A3a3FNLB00dAneHY9pU9--