summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-07-10 12:32:10 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-07-11 18:37:33 -0700
commit7653e6b00c8556869499d85e5f877110eb9b2c65 (patch)
treea128f101082946c7dcf01cd9492276526768c38c
parent42d68538737065799d7e6e53b4a5b3127b7fb60b (diff)
downloaddotfiles-7653e6b00c8556869499d85e5f877110eb9b2c65.tar.gz
add a quick way to save all attachments to ~/tmp/
-rw-r--r--.emacs.d/init.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index f6daa237..75a1f070 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -3141,6 +3141,20 @@ mutt's review view, after exiting EDITOR."
(with-eval-after-load 'gnus-sum
(define-key gnus-summary-mode-map "vf" #'spw/gnus-summary-limit-to-patches))
+(defun spw/gnus-summary-save-all-attachments ()
+ "Save all attachments to ~/tmp/."
+ (interactive)
+ (gnus-eval-in-buffer-window gnus-article-buffer
+ ;; `gnus-summary-save-parts' has some alternative ways to get the handles
+ ;; if `gnus-article-mime-handles' is nil.
+ (let ((handles gnus-article-mime-handles))
+ (when (stringp (car handles)) (pop handles))
+ (mapc #'mm-save-part (cl-remove-if-not #'mm-handle-filename handles)))))
+(with-eval-after-load 'gnus-sum
+ ;; Like `X m' binding.
+ (define-key gnus-summary-mode-map
+ "vm" #'spw/gnus-summary-save-all-attachments))
+
(defun spw/org-gnus-follow-link (orig-fun &optional group article)
(if (not article)
(apply orig-fun group nil)