From fb446c8a34e245ff894a1252b33c9de17833283b Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 6 Oct 2024 16:35:49 +0100 Subject: Handle blank subjects. (message-fetch-field "Subject") returns nil on blank subjects. Handle this. * varuga.el (varuga-message-subject): New function. (varuga-invite): Use varuga-message-subject. --- varuga.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/varuga.el b/varuga.el index ab2b73c..8a2cd70 100644 --- a/varuga.el +++ b/varuga.el @@ -126,6 +126,11 @@ KEY is the name of the ical property and VALUE is its value." (varuga-calendar-components calendar)) (varuga-insert-calendar-line 'end "VCALENDAR")) +(defun varuga-message-subject () + "Return subject of message." + (or (message-fetch-field "Subject") + "")) + (defun varuga-invite (summary location when duration) "Insert calendar invitation into current email message buffer. SUMMARY is a short description of the event. LOCATION is the @@ -135,14 +140,14 @@ is the length of the event in minutes." (interactive (list (read-string "Event Summary: " (string-trim (string-remove-prefix - "Re:" (message-fetch-field "Subject")))) + "Re:" (varuga-message-subject)))) (read-string "Location: ") (org-read-date t t nil "When?") (org-duration-to-minutes (read-string "Duration: ")))) (save-excursion ;; Fill Subject header if it is blank. - (when (string-blank-p (message-fetch-field "Subject")) + (when (string-blank-p (varuga-message-subject)) (save-restriction (message-narrow-to-headers) (re-search-forward "^Subject:") -- cgit v1.2.3