From eb5ef0ae1424a725f933ef3929e5396a2ab727ab Mon Sep 17 00:00:00 2001 From: Mikhail Skorzhinskii Date: Sat, 12 Sep 2020 18:27:23 +0200 Subject: [PATCH] ox-icalendar.el: Customize vevent summary prefix * lisp/ox-icalendar.el (org-icalendar-scheduled-summary-prefix): A new customization option to control summary prefix in exported scheduled events. * lisp/ox-icalendar.el (org-icalendar-deadline-summary-prefix): A new customization option to control summary prefix in exported deadline events. * lisp/ox-icalendar.el (org-icalendar-entry): Use configurable summary prefixes for scheduled and deadline events, instead of hardcoded ones. --- etc/ORG-NEWS | 7 +++++++ lisp/ox-icalendar.el | 21 +++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 713a850f6..3c98e8ba0 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -295,6 +295,13 @@ Use the header argument =:var x=code-block[]= or to pass the contents of a named code block as a string argument. ** New options +*** New custom settings =org-icalendar-scheduled-summary-prefix= and =org-icalendar-deadline-summary-prefix= + +These settings allow users to define prefixes for exported summary +lines in ICS exports. The customization can be used to disable +the prefixes completely or make them a little bit more verbose +(e.g. "Deadline: " instead of the default "DL: "). + *** A new custom setting =org-hide-drawer-startup= to control initial folding state of drawers Previously, all the drawers were always folded when opening an Org diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el index 1a510f2a8..e5b2f7b36 100644 --- a/lisp/ox-icalendar.el +++ b/lisp/ox-icalendar.el @@ -101,6 +101,21 @@ keyword." :group 'org-export-icalendar :type '(repeat (string :tag "Tag"))) +(defcustom org-icalendar-scheduled-summary-prefix "S: " + "String prepended to exported scheduled headlines." + :group 'org-export-icalendar + :type 'string + :package-version '(Org . "9.6") + :safe #'stringp) + + +(defcustom org-icalendar-deadline-summary-prefix "DL: " + "String prepended to exported headlines with a deadline." + :group 'org-export-icalendar + :type 'string + :package-version '(Org . "9.6") + :safe #'stringp) + (defcustom org-icalendar-use-deadline '(event-if-not-todo todo-due) "Contexts where iCalendar export should use a deadline time stamp. @@ -624,7 +639,8 @@ inlinetask within the section." (_ (memq 'event-if-not-todo use-deadline))) (org-icalendar--vevent entry deadline (concat "DL-" uid) - (concat "DL: " summary) loc desc cat tz class))) + (concat org-icalendar-deadline-summary-prefix summary) + loc desc cat tz class))) (let ((scheduled (org-element-property :scheduled entry)) (use-scheduled (plist-get info :icalendar-use-scheduled))) (and scheduled @@ -635,7 +651,8 @@ inlinetask within the section." (_ (memq 'event-if-not-todo use-scheduled))) (org-icalendar--vevent entry scheduled (concat "SC-" uid) - (concat "S: " summary) loc desc cat tz class))) + (concat org-icalendar-scheduled-summary-prefix 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.