From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id MNxQFt+CdmKeigAAbAwnHQ (envelope-from ) for ; Sat, 07 May 2022 16:31:59 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id YPJLFt+CdmLnuAAAauVa8A (envelope-from ) for ; Sat, 07 May 2022 16:31:59 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 35FEB311A1 for ; Sat, 7 May 2022 16:31:58 +0200 (CEST) Received: from localhost ([::1]:51440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnLTR-0000hb-Dd for larch@yhetil.org; Sat, 07 May 2022 10:31:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnLSt-0000Sj-VG for emacs-orgmode@gnu.org; Sat, 07 May 2022 10:31:24 -0400 Received: from mout01.posteo.de ([185.67.36.65]:36221) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnLSr-0006Lu-Ma for emacs-orgmode@gnu.org; Sat, 07 May 2022 10:31:23 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 15E78240027 for ; Sat, 7 May 2022 16:31:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1651933878; bh=lc/+cWi8CjBhvlsKfirQB20/1FQB1D6Qq9ZY8CBH3TU=; h=From:To:Subject:Date:From; b=DZAf77tOlCNphWOlj7W2iMaVqHU591qwjNhcC9dItKxvG1U+F39Rb5+hy6C2HYeg2 8ET+N5XyezSJB319tm3Io5Th30CDer+8n/It/jHcAp4tUzSiC7AuNqyWUKzrfFS8D0 gJSXffIe8iRLdYyKST3I9+Zdi53aaMzIJty6hlWwffMPBFBOJraq2ufam62pgKRWVl LJNiw4CJetgnoKZvPD7p4YSZDhzV8G6MwZK3NI69zEdQN11HuO8WvVK3mwINNV3JbT B3sw0OfXM6yZDLGCgs4TFT8qt0SwBztPW/6YVxIivEBdZxceLGvKfw4EyIwr8QjnIL CYz+O0eA24jOw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4KwVH92zXfz6tmF for ; Sat, 7 May 2022 16:31:17 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: orgmode Subject: [PATCH] org-attach: Attach current Gnus article parts Date: Sat, 07 May 2022 14:31:19 +0000 Message-ID: <87y1zdwh1k.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=maciaschain@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1651933919; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=AjQzrQX2y+Dj7DH6gYqlrtJ7lOZWTrXqoFv1+sOlIcg=; b=gGiN7hjxMRGrfP+N1TMdd5VYKzdaJNcAF0LI3np49wtsfL+ZogaeIMcI3dxlBCKI3up5oe ULBO1OWZyLiqEMX3Yjl06f+kktOyQBjlB5/og+fAxsDqqbpFzMeDAGQ2yMORadh7A722/U D+EwOQBKORen+V/xEm5Rgqr6JG3YSwdVwDUZMoc6pkq2zvX7Z2N//jHH6jYkIOdCuwQkfI 51rSaph3gysy3Y7+cLj1LHa4Rw7oP6DeIEj3Naxrm5JsSHPTOgFYtfsG0ZRJ9IVncL/bIB W9UfLgLaAaJKC8qaFQidPLMPLU/vav8YkrjSFrT02NTBAXgGHSCmiKbRH6SbWQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651933919; a=rsa-sha256; cv=none; b=XMc2SfdTzYqlI6W9SODCeZozU9oRqbh4gGljPy/TVzqXyaKbpfhGV0JGkURu8tXnY+ClV8 1Pwbw6Qyr6PUScx/CDv66aYm5+iWup+n25QUY6jym7KlLEDK1dvSy3x+yntZJcoes6r4uf XOkwowlv7Ooxc4WucBT6l6QMn9HV3SYqWEdD6dBtLTzfGJM4Z/pyqslzdYYYCKhebULMaX YIvfF9XAQJu9AWhg4NfpzPC2q6CST6dScUyFTwvdV9vy4KT2rMRzPnjfw4jW5T1+u8is/n EJO11ilML2EJ5VewPQr0zPSVVMhwDjGvJgCjHAFdZRgmEOyasdPSN7U1Y3Et/g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=DZAf77tO; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -7.30 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=DZAf77tO; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 35FEB311A1 X-Spam-Score: -7.30 X-Migadu-Scanner: scn0.migadu.com X-TUID: VH/TMOuOb/BS --=-=-= Content-Type: text/plain Hi all, In the attached patch I add a new command for org-attach: save *all* attachments from the current Gnus article to the current org-attach-dir. (Sorry for repeating the word "attach" so much :-)) NB: 1. If no Gnus article is open, it returns an error message. 2. I've only tested it on Emacs 28. I don't know if it can cause any problems on earlier Emacs/Gnus versions. 3. Although there are several alternatives to Gnus, I have chosen Gnus specifically because it is part of GNU Emacs. 4. I think an option could be added to save only certain types of files (pdf, png, jpg, docx, etc.). Best regards, Juan Manuel --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-lisp-org-attach.el-new-command-to-attach-Gnus-curren.patch >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 --=-=-=--