From 03a53680df38300110c2095a98bc1dec8cc7adce Mon Sep 17 00:00:00 2001 From: Juan Manuel Macias Date: Sat, 7 May 2022 16:04:06 +0200 Subject: [PATCH] lisp/org-attach.el: new command to attach Gnus current article parts * (org-attach-gnus-save-parts-current-article): Attach current Gnus article parts * (org-attach-commands): add a new key --- lisp/org-attach.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lisp/org-attach.el b/lisp/org-attach.el index 5ee2b84b2..54c8a2bdb 100644 --- a/lisp/org-attach.el +++ b/lisp/org-attach.el @@ -206,6 +206,8 @@ git-functionality from this file.") "Attach a file using symbolic-link method.") ((?u ?\C-u) org-attach-url "Attach a file from URL (downloading it).") + ((?g ?\C-g) org-attach-gnus-save-parts-current-article + "Attach current Gnus article parts") ((?b) org-attach-buffer "Select a buffer and attach its contents to the task.") ((?n ?\C-n) org-attach-new @@ -488,6 +490,21 @@ DIR-property exists (that is different from the unset one)." (let ((org-attach-method 'url)) (org-attach-attach url))) +(defun org-attach-gnus-save-parts-current-article () + "Attach current Gnus article parts." + (interactive) + (let* ((attach-dir (org-attach-dir 'get-create)) + (art gnus-article-current) + (subject (gnus-summary-article-subject (cdr art)))) + (if (not art) + (error "There is no open article") + (if (yes-or-no-p (format "Attach current article: \"%s\"" subject)) + (progn + (org-attach-tag) + (gnus-summary-save-parts "." attach-dir art) + (message "New attachment: \"%s\"" subject)) + (keyboard-quit))))) + (defun org-attach-buffer (buffer-name) "Attach BUFFER-NAME's contents to current outline node. BUFFER-NAME is a string. Signals a `file-already-exists' error -- 2.36.0