add elfeed: org-link type for opening entries from org-roam
- Custom elfeed: link type that opens entries directly in elfeed - Updated my/elfeed-entry-to-org-roam to include elfeed link in note body - Notes now have both ROAM_REFS (web URL) and elfeed link (local viewing) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
c0fd6eedae
commit
9df2b59151
@@ -325,10 +325,62 @@
|
|||||||
(after! elfeed
|
(after! elfeed
|
||||||
(setq elfeed-search-filter "@1-week-ago +unread"))
|
(setq elfeed-search-filter "@1-week-ago +unread"))
|
||||||
|
|
||||||
|
;; Custom elfeed: link type to open entries in elfeed
|
||||||
|
(after! org
|
||||||
|
(org-link-set-parameters
|
||||||
|
"elfeed"
|
||||||
|
:follow (lambda (path)
|
||||||
|
(require 'elfeed)
|
||||||
|
(let* ((id (read path))
|
||||||
|
(entry (elfeed-db-get-entry id)))
|
||||||
|
(if entry
|
||||||
|
(progn
|
||||||
|
(elfeed-show-entry entry)
|
||||||
|
(switch-to-buffer "*elfeed-entry*"))
|
||||||
|
(message "Entry not found in elfeed database: %s" path))))
|
||||||
|
:store (lambda ()
|
||||||
|
(when (eq major-mode 'elfeed-show-mode)
|
||||||
|
(let ((entry elfeed-show-entry))
|
||||||
|
(org-link-store-props
|
||||||
|
:type "elfeed"
|
||||||
|
:link (format "elfeed:%s" (prin1-to-string (elfeed-entry-id entry)))
|
||||||
|
:description (elfeed-entry-title entry)))))))
|
||||||
|
|
||||||
(map! :leader
|
(map! :leader
|
||||||
:desc "Elfeed RSS reader"
|
:desc "Elfeed RSS reader"
|
||||||
"o e" (cmd! (elfeed)))
|
"o e" (cmd! (elfeed)))
|
||||||
|
|
||||||
|
;; Capture elfeed entry to org-roam with ROAM_REFS and elfeed link
|
||||||
|
(defun my/elfeed-entry-to-org-roam ()
|
||||||
|
"Capture current elfeed entry to org-roam with ROAM_REFS and elfeed link."
|
||||||
|
(interactive)
|
||||||
|
(let* ((entry (or elfeed-show-entry
|
||||||
|
(elfeed-search-selected :single)))
|
||||||
|
(title (elfeed-entry-title entry))
|
||||||
|
(url (elfeed-entry-link entry))
|
||||||
|
(date (format-time-string "%Y-%m-%d" (elfeed-entry-date entry)))
|
||||||
|
(elfeed-id (prin1-to-string (elfeed-entry-id entry))))
|
||||||
|
(org-roam-capture-
|
||||||
|
:keys "e"
|
||||||
|
:node (org-roam-node-create :title title)
|
||||||
|
:templates
|
||||||
|
`(("e" "elfeed" plain "%?"
|
||||||
|
:target (file+head
|
||||||
|
"%<%Y%m%d%H%M%S>-${slug}.org"
|
||||||
|
,(concat ":PROPERTIES:\n"
|
||||||
|
":ROAM_REFS: " url "\n"
|
||||||
|
":END:\n"
|
||||||
|
"#+title: ${title}\n"
|
||||||
|
"#+date: " date "\n\n"
|
||||||
|
"[[elfeed:" elfeed-id "][View in Elfeed]]\n\n"))
|
||||||
|
:unnarrowed t)))))
|
||||||
|
|
||||||
|
(map! :after elfeed
|
||||||
|
:map elfeed-show-mode-map
|
||||||
|
:n "C" #'my/elfeed-entry-to-org-roam
|
||||||
|
:map elfeed-search-mode-map
|
||||||
|
:n "C" #'my/elfeed-entry-to-org-roam)
|
||||||
|
|
||||||
;; LLM configuration with gptel
|
;; LLM configuration with gptel
|
||||||
;; Machine-specific backends are configured in config-local.el
|
;; Machine-specific backends are configured in config-local.el
|
||||||
;; This file contains shared settings only
|
;; This file contains shared settings only
|
||||||
|
|||||||
Reference in New Issue
Block a user