From 9df2b591518c8d189050d27325e1df93b75f2f1a Mon Sep 17 00:00:00 2001 From: Willem van den Ende Date: Tue, 20 Jan 2026 10:03:51 +0000 Subject: [PATCH] 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 --- config.el | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/config.el b/config.el index 906dbaf..2a25d18 100644 --- a/config.el +++ b/config.el @@ -325,10 +325,62 @@ (after! elfeed (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 :desc "Elfeed RSS reader" "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 ;; Machine-specific backends are configured in config-local.el ;; This file contains shared settings only