From bea6ae4e3e0814a4dbc81655d9e5ac36064bec1d Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 15 Apr 2018 18:02:50 +0200 Subject: Add new command `gnus-summary-attach-article' * doc/misc/gnus.texi (Summary Message Commands): Document it. * lisp/gnus/gnus-msg.el (gnus-summary-attach-article): New command and keystroke (bug#19788). * lisp/gnus/gnus-sum.el (gnus-summary-make-menu-bar): Menu bar entry for it. --- lisp/gnus/gnus-msg.el | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'lisp/gnus/gnus-msg.el') diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index d5610bff739..6505f90d3e8 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el @@ -393,6 +393,7 @@ Thank you for your help in stamping out bugs. "N" gnus-summary-followup-to-mail-with-original "m" gnus-summary-mail-other-window "u" gnus-uu-post-news + "A" gnus-summary-attach-article "\M-c" gnus-summary-mail-crosspost-complaint "Br" gnus-summary-reply-broken-reply-to "BR" gnus-summary-reply-broken-reply-to-with-original @@ -2000,6 +2001,36 @@ this is a reply." (insert "From: " (message-make-from) "\n")))) nil 'local))))) +(defun gnus-summary-attach-article (n) + "Attach the current article(s) to an outgoing Message buffer. +If any current in-progress Message buffers exist, the articles +can be attached to them. If not, a new Message buffer is +created. + +This command uses the process/prefix convention, so if you +process-mark several articles, they will all be attached." + (interactive "P") + (let ((buffers (message-buffers)) + destination) + ;; Set up the destination mail composition buffer. + (if (and buffers + (y-or-n-p "Attach files to existing mail composition buffer? ")) + (setq destination + (if (= (length buffers) 1) + (get-buffer (car buffers)) + (gnus-completing-read "Attach to buffer" + buffers t nil nil (car buffers)))) + (gnus-summary-mail-other-window) + (setq destination (current-buffer))) + (gnus-summary-iterate n + (gnus-summary-select-article) + (set-buffer destination) + ;; Attach at the end of the buffer. + (save-excursion + (goto-char (point-max)) + (message-forward-make-body-mime gnus-original-article-buffer))) + (gnus-configure-windows 'message t))) + (provide 'gnus-msg) ;;; gnus-msg.el ends here -- cgit v1.2.1