From bea6ae4e3e0814a4dbc81655d9e5ac36064bec1d Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 15 Apr 2018 18:02:50 +0200 Subject: [PATCH] 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. --- doc/misc/gnus.texi | 9 +++++++++ etc/NEWS | 6 ++++++ lisp/gnus/gnus-msg.el | 31 +++++++++++++++++++++++++++++++ lisp/gnus/gnus-sum.el | 1 + 4 files changed, 47 insertions(+) diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index efda7f20b57..77c02182b4b 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -5850,6 +5850,15 @@ buffer (@code{gnus-summary-yank-message}). This command prompts for what message buffer you want to yank into, and understands the process/prefix convention (@pxref{Process/Prefix}). +@item S A +@kindex S A @r{(Summary)} +@findex gnus-summary-attach-article +Attach the current article into an already existing Message +composition buffer (@code{gnus-summary-yank-message}). If no such +buffer exists, a new one is created. This command prompts for what +message buffer you want to yank into, and understands the +process/prefix convention (@pxref{Process/Prefix}). + @end table diff --git a/etc/NEWS b/etc/NEWS index 0c4daee9acf..13033797265 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -210,6 +210,12 @@ concept index in the Gnus manual for the `match-list' entry. +++ *** nil is no longer an allowed value for `mm-text-html-renderer'. ++++ +*** A new Gnus summary mode command, `S A' +(`gnus-summary-attach-article') can be used to attach the current +article(s) to a pre-existing Message buffer, or create a new Message +buffer with the article(s) attached. + ** erc --- 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 diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index aed5aaf01eb..165d8f96490 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -2629,6 +2629,7 @@ gnus-summary-show-article-from-menu-as-charset-%s" cs)))) ["Resend message edit" gnus-summary-resend-message-edit t] ["Send bounced mail" gnus-summary-resend-bounced-mail t] ["Send a mail" gnus-summary-mail-other-window t] + ["Attach article to a message" gnus-summary-attach-article t] ["Create a local message" gnus-summary-news-other-window t] ["Uuencode and post" gnus-uu-post-news :help "Post a uuencoded article"] -- 2.39.5