From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QKNmFW2aUmKWDgEAgWs5BA (envelope-from ) for ; Sun, 10 Apr 2022 10:50:53 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id cCzJEm2aUmIIPgAA9RJhRA (envelope-from ) for ; Sun, 10 Apr 2022 10:50:53 +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 A7403CFC1 for ; Sun, 10 Apr 2022 10:50:52 +0200 (CEST) Received: from localhost ([::1]:38036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ndTHW-0007ih-Vs for larch@yhetil.org; Sun, 10 Apr 2022 04:50:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ndTGe-0007hG-PO for emacs-orgmode@gnu.org; Sun, 10 Apr 2022 04:49:56 -0400 Received: from mout01.posteo.de ([185.67.36.65]:58527) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ndTGc-0000o6-OP for emacs-orgmode@gnu.org; Sun, 10 Apr 2022 04:49:56 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 9537C24002A for ; Sun, 10 Apr 2022 10:49:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1649580589; bh=B583KVp2HwI/XZMvapn92L42gDEnaJ+vDj/+s4b1LAQ=; h=From:To:Subject:Date:From; b=oqz412HY4D836cYsV+hLmtGf9V1ZaLk9Epo4mKXM7kKsufpGAxiGDbSIfTzqu9ZHH hz5w+07gpF4kHJ7VmGfQ+DUlKCnT67iZitU5FVFJhUBT7M2rs8vk81x22xkSstT7hY zXuGOhF2hdRzV0GWBLkiilz8VOrUA2boDtUZ/0Vsa2Iw/eoegMdZtzdDr08f3X7mzh MPxzPIe2NBHuP7qF82XKKV0Nk1lBcN9mYu8W9tvFXLL13cKR4UlpYE/P3kPcX5wbA8 fodO01IzEN2U6uzDpsFaCNaoiXf5Cx1/mrjVuI2t6ONinGqoQVF/zXzKBHTKtBvV+6 69za53JTsy3AA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Kblzc6Zcjz9rxH for ; Sun, 10 Apr 2022 10:49:48 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: orgmode Subject: Save Gnus attachments to Org using org-attach and helm-org-ql Date: Sun, 10 Apr 2022 08:49:46 +0000 Message-ID: <871qy5l3v9.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain 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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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=1649580653; 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=JDnTkklspHK5+A6qLh2eU051kkbnSzuzWawa/TlraP4=; b=VCqyjX855/Dxd5v7l/rUljCaDCsMQzD+hCnPpZzoaNG8Id/PEUTDl9VKklQcYOto2lNFae /uBO3YzvgXYWNMbt1tWVlvYcs3EO370V40StrXxMdApQKIpHCIPqEqo/wiQmquFoeOSCMB dJ35krV62C+Gh0Gx/koDa6qLZJ5Wzl+MruP/rStvbxBbC2eSaLYV1KBr7gJuZT6KUWLi+J sOqHONw2YNyz96YQeOAqII4TyIW6J1qfJQUsLqfy1HJFIiqj83RqDh6rVHtGKCXr1ZyvK1 pE444cdHzB+HFTHAnVNA599wJ0UTeDRgpITQA3kazhM9MsItHiIMY1kS0y828Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1649580653; a=rsa-sha256; cv=none; b=ZBRHU1E/+bbFICyxo56TH8AJHOl0FKtF2jv1+JszcjIv0TdMXNLOljbqyUxEPBnc+0r8Kc 2u4bvTwW8jlZKECa6QIDAmyHgWk4MMCeWmz1INI/cLCY2nHeKWpzGZPJQDbBlg8msiSAlG SdDQl/2H3wjS44PSadrFr8TtUeFa5mBcFJO1xdKQUmiy28IChSyF3XbOnYipVPKIIdf3cz PUMsyucFBO36O/NECXb12/E2z/XFilbc3dbJ68LQmGSf3B77vD6Oqt36BUwMQAdFzoUkIP eQ0ThFCxw08FoQozkRYERuGPh46Y42sf5UC4D/6YPZxJjeTfxG/md9A9o/FCxA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=oqz412HY; 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.87 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=oqz412HY; 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: A7403CFC1 X-Spam-Score: -7.87 X-Migadu-Scanner: scn0.migadu.com X-TUID: GKFkoNHMZ4xg Hi all, I thought it wouldn't be a bad idea to be able to save attachments from GNUS (current article) to any Org node, via org-attach. Since I use helm-org-ql to quickly access the headlines of my org documents, it occurred to me to write this action for helm-org-ql. I share it here in case someone finds it useful. Best regards, Juan Manuel #+begin_src emacs-lisp (defun my-helm-org-ql/gnus-save-parts-to-org-attach (marker) (interactive) (switch-to-buffer (marker-buffer marker)) (goto-char marker) (org-show-entry) (when (not (member "ATTACH" (org-element-property :tags (org-element-at-point)))) (org-toggle-tag "ATTACH")) ;; create attach dir if not exits (let ((atch-dir (org-attach-dir t)) (art gnus-article-current)) (gnus-summary-save-parts "." atch-dir art))) (with-eval-after-load 'helm-org-ql (add-to-list 'helm-org-ql-actions '("Save attachments" . my-helm-org-ql/gnus-save-parts-to-org-attach) t)) #+end_src