feat(mu4e): improve part selection experience
It's not nice having to think of the index of the MIME part you want to look at, it's much nicer to get a completing read with information about those parts.
This commit is contained in:
parent
251705149b
commit
c4aba242a3
1 changed files with 18 additions and 1 deletions
|
@ -202,8 +202,25 @@ Acts like a singular `mu4e-view-save-attachments', without the saving."
|
||||||
(mu4e~view-open-file
|
(mu4e~view-open-file
|
||||||
(mu4e~view-mime-part-to-temp-file (cdr (+mu4e-select-attachment)))))
|
(mu4e~view-mime-part-to-temp-file (cdr (+mu4e-select-attachment)))))
|
||||||
|
|
||||||
|
(defun +mu4e-select-part ()
|
||||||
|
(let ((parts (mu4e~view-gather-mime-parts)) labeledparts)
|
||||||
|
(dolist (part parts)
|
||||||
|
(push (cons (concat (propertize (format "%-2s " (car part)) 'face '(bold font-lock-type-face))
|
||||||
|
(or (cdr (assoc 'filename (assoc "attachment" (cdr part))))
|
||||||
|
(propertize "unnamed" 'face '(italic font-lock-doc-face)))
|
||||||
|
(propertize (format " [%s]" (caaddr part)) 'face 'font-lock-constant-face))
|
||||||
|
part)
|
||||||
|
labeledparts))
|
||||||
|
(cdr (assoc (completing-read "Select part: " (mapcar #'car labeledparts))
|
||||||
|
labeledparts))))
|
||||||
|
|
||||||
|
(defun +mu4e-view-select-mime-part-action ()
|
||||||
|
"Select a MIME part, and perform an action on it."
|
||||||
|
(interactive)
|
||||||
|
(mu4e-view-mime-part-action (car (+mu4e-select-part))))
|
||||||
|
|
||||||
(map! :map mu4e-view-mode-map
|
(map! :map mu4e-view-mode-map
|
||||||
:ne "A" #'mu4e-view-mime-part-action
|
:ne "A" #'+mu4e-view-select-mime-part-action
|
||||||
:ne "p" #'mu4e-view-save-attachments
|
:ne "p" #'mu4e-view-save-attachments
|
||||||
:ne "o" #'+mu4e-open-attachment))
|
:ne "o" #'+mu4e-open-attachment))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue