From 27c6f3fc2b278aded83d364f8924dcf2d96601c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Cadilhac?= Date: Wed, 14 Aug 2019 19:55:07 -0400 Subject: [PATCH] Allow tags to be part of the summary in iCal export * lisp/ox-icalendar.el (org-icalendar-summary-uses-tags): Introduce new variable to include tags in summaries. (org-icalendar-entry): Implement it. * doc/org-manual.org (iCalendar Export): Document org-icalendar-summary-uses-tags. --- doc/org-manual.org | 4 +++- lisp/ox-icalendar.el | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index c0a91ab3e..7d9f9df61 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -15248,7 +15248,9 @@ For tags on the headline, the iCalendar export back-end makes them into iCalendar categories. To tweak the inheritance of tags and TODO states, configure the variable ~org-icalendar-categories~. To assign clock alarms based on time, configure the ~org-icalendar-alarm-time~ -variable. +variable. Additionally, the variable +~org-icalendar-summary-uses-tags~ can be configured to have tags +appear in the title of the event, when SUMMARY is not provided. #+vindex: org-icalendar-store-UID #+cindex: @samp{ID}, property diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el index 779051cb0..9f1c0d43f 100644 --- a/lisp/ox-icalendar.el +++ b/lisp/ox-icalendar.el @@ -119,6 +119,21 @@ This is a list with possibly several symbols in it. Valid symbols are: (const :tag "SCHEDULED in TODO entries become start date" todo-start))) +(defcustom org-icalendar-summary-uses-tags nil + "Whether tags should be added to the title to create the summary. + +If a SUMMARY is provided in the entry, this is irrelevant. +If non-nil, it can be set to `local-tags' or `all-tags' indicating which tags +are used to make up the summary: only tags defined in the current line or all +tags including inherited ones, respectively." + :group 'org-export-icalendar + :type '(choice + (const :tag "Use the tags defined in current line" local-tags) + (const :tag "Use all tags, including inherited ones" all-tags) + (const :tag "Do not use tags in summary" nil))) + + + (defcustom org-icalendar-categories '(local-tags category) "Items that should be entered into the \"categories\" field. @@ -562,6 +577,15 @@ inlinetask within the section." (tz (org-export-get-node-property :TIMEZONE entry (org-property-inherit-p "TIMEZONE")))) + (when (and org-icalendar-summary-uses-tags + (not (org-element-property :SUMMARY entry))) + (let ((tags (mapconcat + (lambda (x) (concat ":" x)) + (org-export-get-tags + entry info nil + (eq org-icalendar-summary-uses-tags 'all-tags))))) + (when tags + (setq summary (concat summary " " tags ":"))))) (concat ;; Events: Delegate to `org-icalendar--vevent' to generate ;; "VEVENT" component from scheduled, deadline, or any -- 2.22.0