summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2024-10-06 16:35:49 +0100
committerArun Isaac2024-10-06 16:37:34 +0100
commitfb446c8a34e245ff894a1252b33c9de17833283b (patch)
tree8c9344e47be79e754989074b48efbe5d3d9cc585
parent55602adf00481591a85b80857613e40a929abdae (diff)
downloadvaruga-fb446c8a34e245ff894a1252b33c9de17833283b.tar.gz
varuga-fb446c8a34e245ff894a1252b33c9de17833283b.tar.lz
varuga-fb446c8a34e245ff894a1252b33c9de17833283b.zip
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.
-rw-r--r--varuga.el9
1 files 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:")