mu4e-compose: fix mu4e-compose-captured-message from sans-subject

In some but not all cases, a missing subject yielded a description=
without anything else.

Let's avoid that.

Fixes #2746.
This commit is contained in:
Dirk-Jan C. Binnema
2024-08-21 19:27:49 +03:00
parent 687db1aed6
commit 79dd15424b

View File

@ -96,16 +96,19 @@ This multiplexes the `message-mode' hooks `message-send-actions',
(defvar mu4e-captured-message) (defvar mu4e-captured-message)
(defun mu4e-compose-attach-captured-message () (defun mu4e-compose-attach-captured-message ()
"Insert the last captured message file as an attachment. "Insert the last captured message file as an attachment.
Messages are captured with `mu4e-action-capture-message'."
Messages are expect to have been captured earlier with
`mu4e-action-capture-message'. Note: this is unrelated to
`org-mode' capturing."
(interactive) (interactive)
(if-let* ((msg mu4e-captured-message) (if-let* ((msg mu4e-captured-message)
(path (plist-get msg :path)) (path (plist-get msg :path))
(path (and (file-exists-p path) path))) (path (and (file-exists-p path) path))
(mml-attach-file (descr (or (plist-get msg :subject) ""))
path (descr
"message/rfc822" (if (and (stringp descr) (not (string-empty-p descr)))
(or (plist-get msg :subject) "No subject") descr "No subject")))
"attachment") (mml-attach-file path "message/rfc822" descr "attachment")
(mu4e-warn "No valid message has been captured"))) (mu4e-warn "No valid message has been captured")))
;; Go to bottom / top ;; Go to bottom / top