1
0
Fork 0
emacs-config/oni-elfeed.el

170 lines
7.9 KiB
EmacsLisp
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;; oni-elfeed.el --- Elfeed configuration -*- lexical-binding: t; -*-
;; Copyright (C) 2019 Tom Willemse
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 2024.0620.151807
;; Package-Requires: (elfeed olivetti)
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Configuration for the elfeed feed reader. Add the following to your init file
;; in case you want to use this configuration:
;;
;; (with-eval-after-load 'elfeed (require 'oni-elfeed))
;;; Code:
(require 'elfeed)
(require 'elfeed-search)
(require 'shr)
(defun oni-elfeed-enable-olivetti-mode ()
"Change olivetti-body-width to match the shr-max-width."
(setq-local olivetti-body-width (1+ shr-max-width))
(olivetti-mode))
(setq elfeed-feeds
'("http://nullprogram.com/feed/"
("http://oremacs.com/atom.xml" emacs)
("http://emacshorrors.com/feed.atom" emacs)
("http://emacsredux.com/atom.xml" emacs)
("http://emacsrocks.com/atom.xml" emacs)
("http://endlessparentheses.com/atom.xml" emacs)
("http://www.masteringemacs.org/feed/" emacs)
("http://pragmaticemacs.com/feed/" emacs)
("http://sachachua.com/blog/category/emacs/feed/" emacs)
("http://planet.lisp.org/rss20.xml" lisp)
"http://aphyr.com/posts.atom"
"https://news.ycombinator.com/rss"
("https://lwn.net/headlines/newrss" linux)
("https://serversforhackers.com/feed.xml" linux)
("http://lispblog.xach.com/rss" lisp)
"http://esr.ibiblio.org/?feed=rss2"
"http://feeds.feedburner.com/GiantRobotsSmashingIntoOtherGiantRobots"
"http://grumpygamer.com/rss2.0"
"http://irreal.org/blog/?feed=rss2"
"http://devblog.avdi.org/feed/"
"http://wingolog.org/feed/atom"
"http://xach.livejournal.com/data/atom"
"http://allanmcrae.com/feed/"
"http://beej.us/blog/rss.xml"
"http://steve-yegge.blogspot.be/atom.xml"
"https://www.archlinux.org/feeds/news/"
("http://blog.quicklisp.org/feeds/posts/default" lisp)
"http://www.gimp.org/news.rdf"
"https://nostarch.com/feeds/comingsoon.xml"
"https://nostarch.com/feeds/newbooks.xml"
"https://drewdevault.com/blog/index.xml"
"https://sourcehut.org/blog/index.xml"
("https://blog.tecosaur.com/tmio/rss.xml" emacs org-mode)
"https://www.opensourcestories.org/index.xml"
"https://neverworkintheory.org/atom.xml"
"https://ag91.github.io/rss.xml"
"https://programming-journal.org/feed.xml"
"https://unzip.dev/rss/"
("http://lambda-the-ultimate.org/rss.xml" lisp)
("https://planet.emacslife.com/atom.xml" emacs)
"https://www.reddit.com/r/wallpapers/new.xml"
"https://picolisp-explored.com/rss.xml"
"https://onethingwell.org/rss"
"https://hackaday.com/tag/cyberdeck/feed/"
"https://bm.babab.nl/feed/atom"
"https://finalspaceends.com/blogs/news.atom"
"https://www.geepawhill.org/weekly/rss"
("https://blabbermouth.net/feed" music)
("https://github.com/roman/golden-ratio.el/commits/master.atom" emacs commits)
("https://github.com/bharadswami/syncthing-status.el/commits/main.atom" emacs commits)
"https://liliputing.com/feed/"
("https://www.futurile.net/feeds/all.atom.xml" guix)
"https://convolv.es/atom.xml"
"https://ianthehenry.com/feed.xml"
"https://funcall.blogspot.com/feeds/posts/default"
"https://tibleiz.net/blog/news.rss"
("https://csscade.com/" css)
"https://ntietz.com/atom.xmlsig"
"https://libreture.com/blog/rss"
"https://jvns.ca/atom.xml"))
(add-hook 'elfeed-new-entry-hook
(elfeed-make-tagger :before "2 weeks ago"
:remove 'unread))
;;; Mark any post from LWN as read if it starts with “[$]”.
(add-hook 'elfeed-new-entry-hook
(elfeed-make-tagger :feed-url (rx "lwn.net")
:entry-title (rx bos (or "[$]"
(seq "Security"
whitespace
"updates"
whitespace
"for")))
:remove 'unread))
;;; Mark any post not containing my resolutions as read.
(add-hook 'elfeed-new-entry-hook
(elfeed-make-tagger :feed-url (rx "reddit.com/r/wallpapers")
:entry-title `(not ,(rx (or (seq "5120" (minimal-match (zero-or-more whitespace)) nonl (minimal-match (zero-or-more whitespace)) "1440")
(seq "1920" (minimal-match (zero-or-more whitespace)) nonl (minimal-match (zero-or-more whitespace)) "1080"))))
:remove 'unread))
;;; Mark any post from Planet Emacslife read if I also follow the originating
;;; blog. This way I won't have so many duplicates.
(defvar oni-elfeed-duplicate-tagger
(elfeed-make-tagger :feed-url (rx "planet.emacslife.com")
:entry-title (rx bos (or "Irreal"
(seq "Sacha" whitespace "Chua")
"Andrea"
(seq "Mickey" whitespace "Petersen"))
":")
:remove 'unread)
"Tagger for elfeed that marks certain posts as read for Emacslife.")
(defvar oni-elfeed-blabbermouth-review-tagger
(elfeed-make-tagger :feed-url (rx "blabbermouth.net")
:entry-link (rx "/reviews/")
:add 'review)
"Tagger that marks any reviews from Blabbermouth.")
(defvar oni-elfeed-blabbermouth-favourite-tagger
(elfeed-make-tagger :feed-url (rx "blabbermouth.net")
:entry-title (rx (or "SLIPKNOT"
(seq "DREAM" whitespace "THEATER")
(seq "BLIND" whitespace "GUARDIAN")
"MASTODON"
"TOOL"
(seq "IRON" whitespace "MAIDEN")
(seq "BLACK" whitespace "SABBATH")
"MEGADETH"
(seq "ZAKK" whitespace "WYLDE")
(seq "BLACK" whitespace "LABEL" whitespace "SOCIETY")
(seq "ORANGE" whitespace "GOBLIN")))
:add 'favourite)
"Tagger that highlights specific bands from Blabbermouth.")
(add-hook 'elfeed-new-entry-hook oni-elfeed-blabbermouth-favourite-tagger)
(add-hook 'elfeed-new-entry-hook oni-elfeed-blabbermouth-review-tagger)
(add-hook 'elfeed-new-entry-hook oni-elfeed-duplicate-tagger)
(add-to-list 'elfeed-search-face-alist '(review :slant italic) t)
(add-to-list 'elfeed-search-face-alist '(favourite :foreground "#f17272") t)
(add-to-list 'elfeed-search-face-alist '(emacs :foreground "#9b7acd") t)
(add-hook 'elfeed-show-mode-hook #'oni-elfeed-enable-olivetti-mode)
(provide 'oni-elfeed)
;;; oni-elfeed.el ends here