emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: stardiviner <numbchild@gmail.com>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: Nicolas Goaziou <n.goaziou@gmail.com>, Org Mode <emacs-orgmode@gnu.org>
Subject: Re: refile captured to all opened Org buffer files as targets
Date: Fri, 27 Dec 2019 09:32:58 +0800	[thread overview]
Message-ID: <87r20qa6yd.fsf@gmail.com> (raw)
In-Reply-To: <878sn0fm6i.fsf@localhost>


Ihor Radchenko <yantar92@gmail.com> writes:

> [offtopic]
>
>> I recently created an org-capture template for elfeed, it is finished. 
>
> Could you share your capture template?

Sure, here it is:

#+begin_src emacs-lisp
;; support Org Mode Capture template
(defun my/org-capture-elfeed-title ()
  (with-current-buffer "*elfeed-entry*"
    (elfeed-entry-title elfeed-show-entry)))
(defun my/org-capture-elfeed-date ()
  (with-current-buffer "*elfeed-entry*"
    (format-time-string
     "[%Y-%m-%d %a %H:%M]"
     (seconds-to-time (elfeed-entry-date elfeed-show-entry)))))
(defun my/org-capture-elfeed-source ()
  (with-current-buffer "*elfeed-entry*"
    (let ((feed (elfeed-entry-feed elfeed-show-entry)))
      (elfeed-feed-title feed))))
(defun my/org-capture-elfeed-content ()
  (with-current-buffer "*elfeed-entry*"
    (let* ((content (elfeed-deref (elfeed-entry-content elfeed-show-entry)))
           (type (elfeed-entry-content-type elfeed-show-entry))
           (feed (elfeed-entry-feed elfeed-show-entry))
           (base-url (and feed (elfeed-compute-base (elfeed-feed-url feed)))))
      (if content
          (if (eq type 'html)
              (org-web-tools--html-to-org-with-pandoc content)
            (insert content))))))

(add-to-list 'org-capture-templates
             '("R" "Capture elfeed [R]SS feed content to Org buffer"
               entry (file "")
               "* %(my/org-capture-elfeed-title)
:PROPERTIES:
:SOURCE: %(my/org-capture-elfeed-source)
:DATE(original): %(my/org-capture-elfeed-date)
:DATE: %u
:END:

%(my/org-capture-elfeed-content)"
               :empty-lines 1
               :jump-to-captured t))
#+end_src

If possible, I might submit this PR to elfeed.el repository.

-- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      

  reply	other threads:[~2019-12-27  1:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-25 13:01 refile captured to all opened Org buffer files as targets stardiviner
2019-12-25 15:40 ` Ihor Radchenko
2019-12-27  1:32   ` stardiviner [this message]
2019-12-27  7:54     ` Ihor Radchenko
2019-12-27  1:17 ` stardiviner
2019-12-27  6:34 ` Adam Porter
2019-12-27 14:10   ` stardiviner

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  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=87r20qa6yd.fsf@gmail.com \
    --to=numbchild@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@gmail.com \
    --cc=yantar92@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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