emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Save Gnus attachments to Org using org-attach and helm-org-ql
@ 2022-04-10  8:49 Juan Manuel Macías
  0 siblings, 0 replies; only message in thread
From: Juan Manuel Macías @ 2022-04-10  8:49 UTC (permalink / raw)
  To: orgmode

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))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-10  8:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-10  8:49 Save Gnus attachments to Org using org-attach and helm-org-ql Juan Manuel Macías

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).