Juan Manuel Macías <maciasch...@posteo.net> writes: > What I don't quite understand is why it wouldn't be appropriate to add a > new entry with the new feature to the org-attach menu.
Thinking about it more, new feature in org-attach menu should actually be ok. My initial logic was that we cannot easily select attach method for entries in the attach menu. However, anything other than 'cp method is meaningless when saving article attachments. > Well, as I said, I have chosen Gnus because it is part of GNU Emacs. In > any case, if anyone wants to write a patch with a more general solution, > I'd encourage them. I think that would be an interesting feature for > org-attach. I only use Gnus and unfortunately I'm not familiar with > other mail reader libraries (I could try to do something more "agnostic" > from message-mode, when I have some more time...). I think that a good example implementation is from notmuch.el. It does not use anything specific to notmuch, just built-in mm-*.el from gnus: (defun notmuch-save-attachments (mm-handle &optional queryp) (notmuch-foreach-mime-part (lambda (p) (let ((disposition (mm-handle-disposition p))) (and (listp disposition) (or (equal (car disposition) "attachment") (and (equal (car disposition) "inline") (assq 'filename disposition))) (or (not queryp) (y-or-n-p (concat "Save '" (cdr (assq 'filename disposition)) "' "))) (mm-save-part p)))) mm-handle)) (defun notmuch-foreach-mime-part (function mm-handle) (cond ((stringp (car mm-handle)) (dolist (part (cdr mm-handle)) (notmuch-foreach-mime-part function part))) ((bufferp (car mm-handle)) (funcall function mm-handle)) (t (dolist (part mm-handle) (notmuch-foreach-mime-part function part))))) Best, Ihor