summaryrefslogtreecommitdiff
path: root/lisp/gnus/gnus-msg.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2018-04-15 18:02:50 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2018-04-15 18:02:50 +0200
commitbea6ae4e3e0814a4dbc81655d9e5ac36064bec1d (patch)
tree9761ca6114b50c8cca3862e2a460e0bd41555ec9 /lisp/gnus/gnus-msg.el
parentc3ca885f4931a3b17b7e826cc866550d264d685a (diff)
downloademacs-bea6ae4e3e0814a4dbc81655d9e5ac36064bec1d.tar.gz
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.
Diffstat (limited to 'lisp/gnus/gnus-msg.el')
-rw-r--r--lisp/gnus/gnus-msg.el31
1 files changed, 31 insertions, 0 deletions
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