From 4d923b6bbc603c7f78050f357dc273681710105c Mon Sep 17 00:00:00 2001 From: Joseph Turner Date: Mon, 22 Apr 2024 00:23:19 -0700 Subject: [PATCH 1/2] mu4e-compose: fix when mu4e-sent-messages-behavior is functional This commits fixes a regression introduced in 85bfe763362b95935a3967f6585e14b3f9890a70 , at which point sent mails ended up in the "cur/" subdirectory of the root maildir when the mu4e-sent-messages-behavior user option was set to a function. --- mu4e/mu4e-compose.el | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/mu4e/mu4e-compose.el b/mu4e/mu4e-compose.el index 701ed93d0..0767ea697 100644 --- a/mu4e/mu4e-compose.el +++ b/mu4e/mu4e-compose.el @@ -330,12 +330,18 @@ Returns the path for the sent message, either in the sent or trash folder, or nil if the message should be removed after sending." (when-let ((sent-dir - (pcase mu4e-sent-messages-behavior - ('delete nil) - ('trash (mu4e-get-trash-folder parent)) - ('sent (mu4e-get-sent-folder parent)) - ((pred functionp) (funcall mu4e-sent-messages-behavior)) - (_ (mu4e-error "Error in `mu4e-sent-messages-behavior'"))))) + ;; We can't call `functionp' since at least 'delete is a function. + (pcase mu4e-sent-messages-behavior + ('delete nil) + ('trash (mu4e-get-trash-folder parent)) + ('sent (mu4e-get-sent-folder parent)) + ((pred functionp) + (pcase (funcall mu4e-sent-messages-behavior) + ('delete nil) + ('trash (mu4e-get-trash-folder parent)) + ('sent (mu4e-get-sent-folder parent)) + (_ (mu4e-error "Error in `mu4e-sent-messages-behavior'")))) + (_ (mu4e-error "Error in `mu4e-sent-messages-behavior'"))))) (mu4e-join-paths (mu4e-root-maildir) sent-dir "cur" (format "%s%s2,S" base-name mu4e-maildir-info-delimiter)))) From f00ca68c670baf30e139a4af381a95e590c82381 Mon Sep 17 00:00:00 2001 From: Joseph Turner Date: Wed, 24 Apr 2024 12:49:06 -0400 Subject: [PATCH 2/2] mu4e-compose: Don't nest pcase --- mu4e/mu4e-compose.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mu4e/mu4e-compose.el b/mu4e/mu4e-compose.el index 0767ea697..0ed93abc0 100644 --- a/mu4e/mu4e-compose.el +++ b/mu4e/mu4e-compose.el @@ -329,18 +329,18 @@ base filename without any Maildir decoration. Returns the path for the sent message, either in the sent or trash folder, or nil if the message should be removed after sending." - (when-let ((sent-dir + (when-let ((sent-behavior ;; We can't call `functionp' since at least 'delete is a function. (pcase mu4e-sent-messages-behavior + ((or 'delete 'trash 'sent) mu4e-sent-messages-behavior) + ((pred functionp mu4e-sent-messages-behavior) + (funcall mu4e-sent-messages-behavior)) + (_ mu4e-sent-messages-behavior))) + (sent-dir + (pcase sent-behavior ('delete nil) ('trash (mu4e-get-trash-folder parent)) ('sent (mu4e-get-sent-folder parent)) - ((pred functionp) - (pcase (funcall mu4e-sent-messages-behavior) - ('delete nil) - ('trash (mu4e-get-trash-folder parent)) - ('sent (mu4e-get-sent-folder parent)) - (_ (mu4e-error "Error in `mu4e-sent-messages-behavior'")))) (_ (mu4e-error "Error in `mu4e-sent-messages-behavior'"))))) (mu4e-join-paths (mu4e-root-maildir) sent-dir "cur"