From a50bd935df695e1f6e720761cba39c34af0c1cda Mon Sep 17 00:00:00 2001 From: Jake Coble Date: Sat, 7 Jun 2025 18:26:55 -0400 Subject: Format ORGANIZER CN as property parameter. * varuga.el (varuga-insert-calendar-line): Support property parameters. (varuga-insert-calendar-event): Format ORGANIZER CN as property parameter. Signed-off-by: Arun Isaac --- varuga.el | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'varuga.el') diff --git a/varuga.el b/varuga.el index 16c3f6e..2b6776d 100644 --- a/varuga.el +++ b/varuga.el @@ -75,9 +75,10 @@ (defvar varuga-time-format world-clock-time-format) -(defun varuga-insert-calendar-line (key value) +(defun varuga-insert-calendar-line (key value &optional params) "Insert ical calendar line. -KEY is the name of the ical property and VALUE is its value." +KEY is the name of the ical property and VALUE is its value. +PARAMS is an alist of ical property parameters and their values." ;; Limit content line length to 75 octets as required by RFC 5545. (let ((maximum-octets-per-line 75) (octets-so-far 0)) @@ -95,8 +96,14 @@ KEY is the name of the ical property and VALUE is its value." ;; the folding space. (setq octets-so-far (1+ (string-bytes str)))) (insert str))) - (format "%s:%s" + (format "%s%s:%s" (upcase (symbol-name key)) + (seq-mapcat (pcase-lambda (`(,key . ,value)) + (format ";%s=%s" + (upcase (symbol-name key)) + value)) + params + 'string) value))) (insert "\n")) @@ -111,9 +118,9 @@ KEY is the name of the ical property and VALUE is its value." (varuga-insert-calendar-line 'dtstamp (varuga-format-time-string (current-time))) (varuga-insert-calendar-line 'organizer - (format "CN=%s:MAILTO:%s" - (varuga-calendar-event-organizer event) - (varuga-calendar-event-organizer-email-address event))) + (format "MAILTO:%s" + (varuga-calendar-event-organizer-email-address event)) + `((cn . ,(varuga-calendar-event-organizer event)))) (varuga-insert-calendar-line 'dtstart (varuga-format-time-string (varuga-calendar-event-time-start event))) -- cgit v1.2.3