Skip to content

Commit

Permalink
Fix issue with ekg-email and emails without cc's
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyatt committed Sep 2, 2024
1 parent 693838b commit 535876f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions contrib/ekg-email.el
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,22 @@
(defun ekg-email-from-gnus ()
"Create a note with the current email as content and metadata."
(interactive nil gnus-article-mode)
(let ((to (mapcar #'string-trim (split-string (gnus-fetch-field "To") ",")))
(from (gnus-fetch-field "From"))
(cc (mapcar #'string-trim (split-string (gnus-fetch-field "Cc") ",")))
(subject (gnus-fetch-field "Subject"))
(message-id (gnus-fetch-field "Message-ID")))
(let* ((to (mapcar #'string-trim (split-string (gnus-fetch-field "To") ",")))
(from (gnus-fetch-field "From"))
(cc (when-let ((cc (gnus-fetch-field "Cc")))
(mapcar #'string-trim (split-string cc ","))))
(subject (gnus-fetch-field "Subject"))
(prop-plist `(:email/to ,to :email/from ,from :titled/title ,subject)))
(when cc
(plist-put prop-plist :email/cc cc))
(ekg-capture
:text (gnus-with-article-buffer
(buffer-substring-no-properties
(save-excursion
(article-goto-body)
(point))
(point-max)))
:properties `(:email/to ,to :email/from ,from :email/cc ,cc
:titled/title ,subject))))
:properties prop-plist)))

(defun ekg-email-save (note)
"On a save, for any email addresses, type them with email-address.
Expand Down

0 comments on commit 535876f

Please sign in to comment.