emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Juan Manuel Macías" <maciaschain@posteo.net>
To: orgmode <emacs-orgmode@gnu.org>
Subject: Save Gnus attachments to Org using org-attach and helm-org-ql
Date: Sun, 10 Apr 2022 08:49:46 +0000	[thread overview]
Message-ID: <871qy5l3v9.fsf@posteo.net> (raw)

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)
    (switch-to-buffer (marker-buffer marker))
    (goto-char marker)
    (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))

                 reply	other threads:[~2022-04-10  8:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871qy5l3v9.fsf@posteo.net \
    --to=maciaschain@posteo.net \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).