summaryrefslogtreecommitdiff
path: root/.emacs.d/modules/thanos-elfeed.el
blob: 377e51017f73eaa6c8d7e1444700b4c4f0a496f0 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
;;; thanos-elfeed.el --- elfeed configuration        -*- lexical-binding: t; -*-

;; Copyright (C) 2023  Thanos Apollo

;; Author: Thanos Apollo <[email protected]>
;; Keywords: extensions

;; 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:
;; ╭━━━━┳╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━━━╮╱╱╱╱╱╭╮╭╮╱╱╱╱╱╱╱╱╭━━━╮
;; ┃╭╮╭╮┃┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭━╮┃╱╱╱╱╱┃┃┃┃╱╱╱╱╱╱╱╱┃╭━━╯
;; ╰╯┃┃╰┫╰━┳━━┳━╮╭━━┳━━╮┃┃╱┃┣━━┳━━┫┃┃┃╭━━╮╱╱╱╱┃╰━━┳╮╭┳━━┳━━┳━━╮
;; ╱╱┃┃╱┃╭╮┃╭╮┃╭╮┫╭╮┃━━┫┃╰━╯┃╭╮┃╭╮┃┃┃┃┃╭╮┃╭━━╮┃╭━━┫╰╯┃╭╮┃╭━┫━━┫
;; ╱╱┃┃╱┃┃┃┃╭╮┃┃┃┃╰╯┣━━┃┃╭━╮┃╰╯┃╰╯┃╰┫╰┫╰╯┃╰━━╯┃╰━━┫┃┃┃╭╮┃╰━╋━━┃
;; ╱╱╰╯╱╰╯╰┻╯╰┻╯╰┻━━┻━━╯╰╯╱╰┫╭━┻━━┻━┻━┻━━╯╱╱╱╱╰━━━┻┻┻┻╯╰┻━━┻━━╯
;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃┃
;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯
;;; Code:

(require 'elfeed)
(require 'elfeed-goodies)


(setf elfeed-feeds
      '(("https://hackaday.com/blog/feed/"
	 hackaday linux)
	("https://protesilaos.com/news.xml"
	 protesilaos)
	("https://protesilaos.com/codelog.xml"
	 proetesilaos)
	("https://guix.gnu.org/feeds/blog.atom"
	 gnu guix)
	("https://thanosapollo.com/posts/index.xml"
	 thanos)
	("http://nullprogram.com/feed/"
	 emacs linux)
	("https://drewdevault.com/blog/index.xml"
	 sourcehut drewdevault)
	("https://archlinux.org/feeds/news/"
	 ArchLinux Latest)
	("http://wikileaks.org/feed"
	 wikileaks)
	("https://hackernoon.com/feed"
	 hackernoon)
	("https://sachachua.com/blog/feed/"
	 sacha emacs)
	("https://bits.debian.org/feeds/feed.rss"
	 debian linux)
	("https://torrentfreak.com/feed"
	 torrentfreak)
	("https://wp.medscape.com/cx/rssfeeds/2700.xml"
	 med medscape)
	("https://www.science.org/action/showFeed?type=etoc&feed=rss&jc=sciimmunol"
	 science)
	("https://www.who.int/rss-feeds/news-english.xml"
	 who medicine)
	("https://www.addtoany.com/add_to/feed?linkurl=http%3A%2F%2Fwww.thelancet.com%2Frssfeed%2Flancet_online.xml&type=feed&linkname=The%20Lancet%20Online%20First&linknote="
	 lancet medicine)
	("https://www.addtoany.com/add_to/feed?linkurl=http%3A%2F%2Fwww.thelancet.com%2Frssfeed%2Flanhae_online.xml&type=feed&linkname=The%20Lancet%20Haematology%20Online%20First&linknote="
	lancet haematology medicine)))

(defun elfeed-mpv (&optional use-generic-p)
  "Play video link with mpv."
  (interactive "P")
  (let ((entries (elfeed-search-selected)))
    (cl-loop for entry in entries
	     do (elfeed-untag entry 'unread)
	     when (elfeed-entry-link entry)
	     do (start-process-shell-command "elfeed-video" nil (format "mpv \"%s\"" it)))
    (mapc #'elfeed-search-update-entry entries)
    (unless (use-region-p) (forward-line))))

(setf elfeed-goodies/entry-pane-size 0.55)
(elfeed-goodies/setup)

(define-key thanos/applications-map (kbd "f") 'elfeed)
(define-key elfeed-search-mode-map (kbd "v") 'elfeed-mpv)
(define-key elfeed-search-mode-map (kbd "U") 'elfeed-update)
(define-key thanos/applications-map (kbd "f") 'elfeed)

(provide 'thanos-elfeed)
;;; thanos-elfeed.el ends here