From: Jakub Czajka Date: Wed, 18 Dec 2024 18:11:14 +0000 (+0100) Subject: [emacs] Pull RSS feed from a RSS server. X-Git-Url: https://git.ekhem.eu.org/?a=commitdiff_plain;h=3328410d14a2c1d2ed4b5495c3f6ea908596f3f1;p=guix.git [emacs] Pull RSS feed from a RSS server. --- diff --git a/emacs/.config/emacs/conf/conf-rss.el b/emacs/.config/emacs/conf/conf-rss.el index 15f88cb..ee44097 100644 --- a/emacs/.config/emacs/conf/conf-rss.el +++ b/emacs/.config/emacs/conf/conf-rss.el @@ -12,12 +12,44 @@ :type 'directory :group 'conf:configuration) -(defcustom conf:elfeed-opml-file - (expand-file-name "~/rss_feed.opml") - "OPML file with RSS feeds to follow." +(defcustom conf:elfeed-protocol-certificate + "" + "Certificate for connecting to a RSS server." :type 'file :group 'conf:configuration) +(defcustom conf:elfeed-protocol-key + "" + "Key for connecting to a RSS server." + :type 'file + :group 'conf:configuration) + +;; elfeed-protocol does not support native Miniflux API. However, Miniflux +;; implements Fever API which elfeed-protocol does support [1]. +;; +;; [1] https://github.com/fasheng/elfeed-protocol/issues/39 +(use-package elfeed-protocol + :ensure t + ;; Load when `elfeed' is first opened because `elfeed-protocol' will ask for + ;; credentials. + :defer t + :config + (setq elfeed-curl-extra-arguments + (list "-E" + conf:elfeed-protocol-certificate + "--key" + conf:elfeed-protocol-key)) + (setq elfeed-protocol-fever-update-unread-only t) + (setq elfeed-protocol-fever-fetch-category-as-tag t) + (setq elfeed-protocol-feeds + (list + (list (concat "fever+https://" + (password-store-get-field "server/miniflux" "username") + "@rss.dobity.eu.org") + :api-url "https://rss.dobity.eu.org/fever/" + :password (password-store-get "server/miniflux")))) + (setq elfeed-protocol-enabled-protocols '(fever))) + (use-package elfeed :requires (conf-keys) @@ -27,11 +59,10 @@ :bind ("C-c f" . elfeed) (:map elfeed-search-mode-map - ("?" . conf:elfeed-transient) - ([remap elfeed-search-fetch] . conf:elfeed-load-opml-and-fetch)) + ("?" . conf:elfeed-transient)) :custom (elfeed-db-directory conf:elfeed-db-directory) - (elfeed-search-filter "@1-week-ago +unread ![$]") + (elfeed-search-filter "@1-week-ago +unread") :config (transient-define-prefix conf:elfeed-transient () "Transient keymap with usefeul commands for `elfeed'." @@ -56,11 +87,6 @@ ("h" "help" describe-mode) ("q" "quit" elfeed-search-quit-window)]]) - (defun conf:elfeed-load-opml-and-fetch () - "Insert `conf:elfeed-opml-file' file to `elfeed-feeds' and update feed." - (interactive) - (when (file-exists-p conf:elfeed-opml-file) - (elfeed-load-opml conf:elfeed-opml-file)) - (call-interactively #'elfeed-search-fetch))) + (elfeed-protocol-enable)) (provide 'conf-rss)