Browse Source

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.
Mikhail Skorzhinskii 4 years ago
parent
commit
eb5ef0ae14
2 changed files with 26 additions and 2 deletions
  1. 7 0
      etc/ORG-NEWS
  2. 19 2
      lisp/ox-icalendar.el

+ 7 - 0
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.
 to pass the contents of a named code block as a string argument.
 
 
 ** New options
 ** 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
 *** 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
 Previously, all the drawers were always folded when opening an Org

+ 19 - 2
lisp/ox-icalendar.el

@@ -101,6 +101,21 @@ keyword."
   :group 'org-export-icalendar
   :group 'org-export-icalendar
   :type '(repeat (string :tag "Tag")))
   :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)
 (defcustom org-icalendar-use-deadline '(event-if-not-todo todo-due)
   "Contexts where iCalendar export should use a deadline time stamp.
   "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)))
 		   (_ (memq 'event-if-not-todo use-deadline)))
 		 (org-icalendar--vevent
 		 (org-icalendar--vevent
 		  entry deadline (concat "DL-" uid)
 		  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))
 	  (let ((scheduled (org-element-property :scheduled entry))
 		(use-scheduled (plist-get info :icalendar-use-scheduled)))
 		(use-scheduled (plist-get info :icalendar-use-scheduled)))
 	    (and scheduled
 	    (and scheduled
@@ -635,7 +651,8 @@ inlinetask within the section."
 		   (_ (memq 'event-if-not-todo use-scheduled)))
 		   (_ (memq 'event-if-not-todo use-scheduled)))
 		 (org-icalendar--vevent
 		 (org-icalendar--vevent
 		  entry scheduled (concat "SC-" uid)
 		  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
 	  ;; When collecting plain timestamps from a headline and its
 	  ;; title, skip inlinetasks since collection will happen once
 	  ;; title, skip inlinetasks since collection will happen once
 	  ;; ENTRY is one of them.
 	  ;; ENTRY is one of them.