From: Jakub Czajka Date: Fri, 23 Dec 2022 18:37:10 +0000 (+0100) Subject: [emacs] Install a RSS client (elfeed). X-Git-Url: https://git.ekhem.eu.org/?a=commitdiff_plain;h=2fbb8c3d2d4eaab7e58fe97b0720d143db5e71a0;p=guix.git [emacs] Install a RSS client (elfeed). --- diff --git a/conf/home/emacs.scm b/conf/home/emacs.scm index f857ba4..0cad0c9 100644 --- a/conf/home/emacs.scm +++ b/conf/home/emacs.scm @@ -8,6 +8,7 @@ #:use-module (gnu home services) #:use-module (gnu home services shepherd) #:use-module (gnu packages aspell) + #:use-module (gnu packages curl) #:use-module (gnu packages emacs) #:use-module (gnu packages emacs-xyz) #:use-module (gnu packages freedesktop) @@ -163,6 +164,15 @@ (list "bash/.config/profile.d/50-gpg.sh" "bash/.config/profile.d/50-pass.sh" "emacs/.config/emacs/conf/conf-crypt.el"))))) + +(define emacs-rss-service + (service home-program-service-type + (home-program-configuration + (packages + (list curl emacs-elfeed)) + (dotfiles + (list "emacs/.config/emacs/conf/conf-rss.el"))))) + (define emacs-service (service home-program-service-type (home-program-configuration @@ -192,4 +202,5 @@ emacs-org-service emacs-package-service emacs-pass-service + emacs-rss-service emacs-service)) diff --git a/emacs/.config/emacs/conf/conf-rss.el b/emacs/.config/emacs/conf/conf-rss.el new file mode 100644 index 0000000..e6550d8 --- /dev/null +++ b/emacs/.config/emacs/conf/conf-rss.el @@ -0,0 +1,66 @@ +;; Copyright (c) 2022 Jakub Czajka +;; License: GPL-3.0 or later. +;; +;; conf-rss.el - configuration for the RSS reader. + +(require 'conf-package) +(require 'conf-variables) + +(defcustom conf:elfeed-db-directory + (expand-file-name "~/Elfeed") + "Directory with the `elfeed' database." + :type 'directory + :group 'conf:configuration) + +(defcustom conf:elfeed-opml-file + (expand-file-name "~/rss_feed.opml") + "OPML file with RSS feeds to follow." + :type 'file + :group 'conf:configuration) + +(use-package elfeed + :requires + (conf-keys) + :when + (conf:executables-p (list "curl")) + :ensure t + :bind + ("C-c f" . elfeed) + (:map elfeed-search-mode-map + ("?" . conf:elfeed-transient) + ([remap elfeed-search-fetch] . conf:elfeed-load-opml-and-fetch)) + :custom + (elfeed-db-directory conf:elfeed-db-directory) + (elfeed-search-filter "@1-week-ago +unread ![$]") + :config + (transient-define-prefix conf:elfeed-transient () + "Transient keymap with usefeul commands for `elfeed'." + [["Update" + ("g" "refresh" elfeed-search-update--force) + ("G" "fetch" elfeed-search-fetch)] + ["Search" + ("RET" "show" elfeed-search-show-entry) + ("c" "clear" elfeed-search-clear-filter) + ("b" "url" elfeed-search-browse-url) + ("s" "search" elfeed-search-live-filter) + ("S" "filter" elfeed-search-set-filter)] + ["Navigation" + ("<" "first entry" elfeed-search-first-entry) + (">" "last entry" elfeed-search-last-entry)] + ["Tags" + ("r" "read" elfeed-search-untag-all-unread) + ("u" "unread" elfeed-search-tag-all-unread) + ("+" "tag all" elfeed-search-tag-all) + ("-" "untag all" elfeed-search-untag-all)] + ["Others" + ("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))) + +(provide 'conf-rss)