emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: refile captured to all opened Org buffer files as targets


From: stardiviner
Subject: Re: refile captured to all opened Org buffer files as targets
Date: Fri, 27 Dec 2019 09:32:58 +0800
User-agent: mu4e 1.3.2; emacs 27.0.50

Ihor Radchenko <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]