tweak(mu4e): try harder to attach files in order

In 4d9ea6853b I reacted to a either a change that I presume occurred
in org-msg at some point, or behaviour originally unnoticed, that led to
bulk-selected files being attached in reverse. Further investigation has
indicated that this isn't actually making attachment order work as
expected, just hiding the reverse behaviour from bulk-attachment. The
better approach is to keep the dired mark reversal, and change
org-msg-attach-attach to add new files to the end, not the start, of the
list of attachments.
This commit is contained in:
TEC 2022-09-24 19:28:17 +08:00 committed by Henrik Lissner
parent 30a4eb7f77
commit f2d62acaad
2 changed files with 10 additions and 1 deletions

View file

@ -292,7 +292,7 @@ When otherwise called, open a dired buffer and enable `dired-mu4e-attach-ctrl-c-
(mapcar
;; don't attach directories
(lambda (f) (if (file-directory-p f) nil f))
(dired-map-over-marks (dired-get-filename) nil)))))
(nreverse (dired-map-over-marks (dired-get-filename) nil))))))
(if (not files-to-attach)
(progn
(message "No files marked, aborting.")

View file

@ -426,6 +426,15 @@ Usefull for affecting HTML export config.")
:localleader
:desc "attach" "a" #'+mu4e/attach-files)
;; I feel like it's reasonable to expect files to be attached
;; in the order you attach them, not the reverse.
(defadvice! +org-msg-attach-attach-in-order-a (file &rest _args)
"Link FILE into the list of attachment."
:override #'org-msg-attach-attach
(interactive (list (read-file-name "File to attach: ")))
(let ((files (org-msg-get-prop "attachment")))
(org-msg-set-prop "attachment" (nconc files (list file)))))
(defvar +mu4e-compose-org-msg-toggle-next t ; t to initialise org-msg
"Whether to toggle ")
(defun +mu4e-compose-org-msg-handle-toggle (toggle-p)