all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tobias Schlemmer <keinstein_junior@gmx.net>
To: "emacs-orgmode@gnu.org >> emacs-orgmode" <emacs-orgmode@gnu.org>
Subject: Revised iCalendar visibility
Date: Tue, 26 Jun 2018 11:00:05 +0200	[thread overview]
Message-ID: <6e29594c-744b-6fd6-6136-97f0c76a01d2@gmx.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 315 bytes --]

Hi,

some time ago sent pull request from GitHub to support per-entry
visibility in iCalendar export.

I attach the patch and some short documentation of the feature in the
attaced files. They have been updated to honour the timezone patch and
the documentation switch from texinfo to org-mode.

Regards,


Tobias


[-- Attachment #2: 0001-Add-support-for-the-iCalendar-CLASS-property.patch --]
[-- Type: text/x-patch, Size: 4884 bytes --]

From fb3bd3b3a953569af6bb3e41c7d4338b41c4a1fc Mon Sep 17 00:00:00 2001
From: Tobias Schlemmer <keinstein@users.sourceforge.net>
Date: Fri, 11 Aug 2017 22:18:06 +0200
Subject: [PATCH 1/2] Add support for the iCalendar CLASS property

* ox-icalendar.el (org-icalendar-entry): Pick the CLASS
property and pass it to `org-icalendar--vevent' and
`org-icalendar--vtodo'.
(org-icalendar--vevent,org-icalendar--vtodo): Add a new parameter
`class' and use it to generate a `CLASS' field in the `VEVENT'
entry.

TINYCHANGE
---
 lisp/ox-icalendar.el | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index 7d7c85004..e410fa2ed 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -540,6 +540,10 @@ inlinetask within the section."
 		   (org-export-get-node-property
 		    :LOCATION entry
 		    (org-property-inherit-p "LOCATION"))))
+	     (class (org-icalendar-cleanup-string
+		     (org-export-get-node-property
+		      :CLASS entry
+		      (org-property-inherit-p "CLASS"))))
 	     ;; Build description of the entry from associated section
 	     ;; (headline) or contents (inlinetask).
 	     (desc
@@ -568,14 +572,14 @@ inlinetask within the section."
 		       org-icalendar-use-deadline)
 		 (org-icalendar--vevent
 		  entry deadline (concat "DL-" uid)
-		  (concat "DL: " summary) loc desc cat tz)))
+		  (concat "DL: " summary) loc desc cat tz class)))
 	  (let ((scheduled (org-element-property :scheduled entry)))
 	    (and scheduled
 		 (memq (if todo-type 'event-if-todo 'event-if-not-todo)
 		       org-icalendar-use-scheduled)
 		 (org-icalendar--vevent
 		  entry scheduled (concat "SC-" uid)
-		  (concat "S: " summary) loc desc cat tz)))
+		  (concat "S: " summary) loc desc cat tz class)))
 	  ;; When collecting plain timestamps from a headline and its
 	  ;; title, skip inlinetasks since collection will happen once
 	  ;; ENTRY is one of them.
@@ -593,7 +597,7 @@ inlinetask within the section."
 			   ((t) t)))
 		   (let ((uid (format "TS%d-%s" (cl-incf counter) uid)))
 		     (org-icalendar--vevent
-		      entry ts uid summary loc desc cat tz))))
+		      entry ts uid summary loc desc cat tz class))))
 	       info nil (and (eq type 'headline) 'inlinetask))
 	     ""))
 	  ;; Task: First check if it is appropriate to export it.  If
@@ -607,7 +611,7 @@ inlinetask within the section."
 			     (not (org-icalendar-blocked-headline-p
 				   entry info))))
 		       ((t) (eq todo-type 'todo))))
-	    (org-icalendar--vtodo entry uid summary loc desc cat tz))
+	    (org-icalendar--vtodo entry uid summary loc desc cat tz class))
 	  ;; Diary-sexp: Collect every diary-sexp element within ENTRY
 	  ;; and its title, and transcode them.  If ENTRY is
 	  ;; a headline, skip inlinetasks: they will be handled
@@ -638,7 +642,7 @@ inlinetask within the section."
        contents))))
 
 (defun org-icalendar--vevent
-    (entry timestamp uid summary location description categories timezone)
+    (entry timestamp uid summary location description categories timezone class)
   "Create a VEVENT component.
 
 ENTRY is either a headline or an inlinetask element.  TIMESTAMP
@@ -648,7 +652,9 @@ summary or subject for the event.  LOCATION defines the intended
 venue for the event.  DESCRIPTION provides the complete
 description of the event.  CATEGORIES defines the categories the
 event belongs to.  TIMEZONE specifies a time zone for this event
-only.
+only. CLASS contains the visibility attribute. Three of them
+(PUBLIC, CONFIDENTIAL and PRIVATE) are predefined, others
+should be treated as PRIVATE if they are unknown to the iCalendar server.
 
 Return VEVENT component as a string."
   (org-icalendar-fold-string
@@ -669,6 +675,7 @@ Return VEVENT component as a string."
 		       (org-element-property :repeater-value timestamp)))
 	     "SUMMARY:" summary "\n"
 	     (and (org-string-nw-p location) (format "LOCATION:%s\n" location))
+	     (and (org-string-nw-p class) (format "CLASS:%s\n" class))
 	     (and (org-string-nw-p description)
 		  (format "DESCRIPTION:%s\n" description))
 	     "CATEGORIES:" categories "\n"
@@ -677,7 +684,7 @@ Return VEVENT component as a string."
 	     "END:VEVENT"))))
 
 (defun org-icalendar--vtodo
-  (entry uid summary location description categories timezone)
+  (entry uid summary location description categories timezone class)
   "Create a VTODO component.
 
 ENTRY is either a headline or an inlinetask element.  UID is the
@@ -712,6 +719,7 @@ Return VTODO component as a string."
 			  "\n"))
 	     "SUMMARY:" summary "\n"
 	     (and (org-string-nw-p location) (format "LOCATION:%s\n" location))
+	     (and (org-string-nw-p class) (format "CLASS:%s\n" class))
 	     (and (org-string-nw-p description)
 		  (format "DESCRIPTION:%s\n" description))
 	     "CATEGORIES:" categories "\n"
-- 
2.18.0.rc2


[-- Attachment #3: 0002-Add-support-for-the-iCalendar-CLASS-property.patch --]
[-- Type: text/x-patch, Size: 3029 bytes --]

From 128d45bf1c7f9b2b01009f9a8f87862aaaf934c0 Mon Sep 17 00:00:00 2001
From: Tobias Schlemmer <keinstein@users.sourceforge.net>
Date: Tue, 26 Jun 2018 10:05:41 +0200
Subject: [PATCH 2/2] Add support for the iCalendar CLASS property

* doc/org-manual.org (iCalendar export): Document the CLASS tag

    TINYCHANGE
---
 doc/org-manual.org | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index ee25fc78b..68da3adff 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -15029,18 +15029,20 @@ connections.
 #+cindex: @samp{DESCRIPTION}, property
 #+cindex: @samp{LOCATION}, property
 #+cindex: @samp{TIMEZONE}, property
+#+cindex: @samp{CLASS}, property
 The iCalendar export back-end includes =SUMMARY=, =DESCRIPTION=,
-=LOCATION= and =TIMEZONE= properties from the Org entries when
-exporting.  To force the back-end to inherit the =LOCATION= and
-=TIMEZONE= properties, configure the ~org-use-property-inheritance~
-variable.
+=LOCATION=, =TIMEZONE= and =CLASS= properties from the Org entries
+when exporting.  To force the back-end to inherit the =LOCATION=,
+=TIMEZONE= and =CLASS= properties, configure the
+~org-use-property-inheritance~ variable.
 
 #+vindex: org-icalendar-include-body
-When Org entries do not have =SUMMARY=, =DESCRIPTION= and =LOCATION=
-properties, the iCalendar export back-end derives the summary from the
-headline, and derives the description from the body of the Org item.
-The ~org-icalendar-include-body~ variable limits the maximum number of
-characters of the content are turned into its description.
+When Org entries do not have =SUMMARY=, =DESCRIPTION=, =LOCATION= and
+=CLASS= properties, the iCalendar export back-end derives the summary
+from the headline, and derives the description from the body of the
+Org item.  The ~org-icalendar-include-body~ variable limits the
+maximum number of characters of the content are turned into its
+description.
 
 The =TIMEZONE= property can be used to specify a per-entry time zone,
 and is applied to any entry with timestamp information.  Time zones
@@ -15048,6 +15050,16 @@ should be specified as per the IANA time zone database format, e.g.,
 =Asia/Almaty=.  Alternately, the property value can be =UTC=, to force
 UTC time for this entry only.
 
+The =CLASS= property can be used to specify a per-entry visibility
+class or access restrictions, and is applied to any entry with class
+information. The iCalendar standard defines three visibility classes:
+- PUBLIC :: The entry is publicly visible (this is the default).
+- CONFIDENTIAL :: Only a limited group of clients get access to the
+     event.
+- PRIVATE :: The entry can be retrieved only by its owner.
+The server should treat unknown class
+properties the same as PRIVATE.
+
 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
-- 
2.18.0.rc2


             reply	other threads:[~2018-06-26  9:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-26  9:00 Tobias Schlemmer [this message]
2018-06-26  9:53 ` Revised iCalendar visibility Nicolas Goaziou
2018-06-26 17:53   ` Tobias Schlemmer
2018-06-27  6:26     ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6e29594c-744b-6fd6-6136-97f0c76a01d2@gmx.net \
    --to=keinstein_junior@gmx.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.