summary refs log tree commit diff
path: root/emacs
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-04-17 16:49:39 -0700
committerFranck Cuny <franck@fcuny.net>2022-04-17 16:49:39 -0700
commit9d1d9f30de311e8816d217a44bc61f59c7457a5a (patch)
tree0678d5279cb1c05545ec633dd95a4173a81e520f /emacs
parentelfeed: update list of feeds (diff)
downloademacs.d-9d1d9f30de311e8816d217a44bc61f59c7457a5a.tar.gz
elfeed: enable elfeed
Diffstat (limited to '')
-rw-r--r--emacs/custom/my-elfeed.el62
-rw-r--r--emacs/init.el1
2 files changed, 63 insertions, 0 deletions
diff --git a/emacs/custom/my-elfeed.el b/emacs/custom/my-elfeed.el
new file mode 100644
index 0000000..7bca54f
--- /dev/null
+++ b/emacs/custom/my-elfeed.el
@@ -0,0 +1,62 @@
+;;; my-elfeed.el --- Configure elfeed -*- lexical-binding: t -*-
+;;; Commentary:
+;;; Code:
+
+(require 'use-package)
+
+(use-package elfeed
+  :ensure t
+  :init
+  (setq elfeed-db-directory (expand-file-name "var/elfeed" user-emacs-directory))
+  :config
+  (eval-after-load 'elfeed-search
+    '(define-key elfeed-search-mode-map (kbd "*") 'elfeed-toggle-star)))
+
+(use-package elfeed-org
+  :ensure t
+  :config
+  (elfeed-org)
+  (setq rmh-elfeed-org-files (list (expand-file-name "etc/elfeed.org" user-emacs-directory))))
+
+(defalias 'elfeed-toggle-star
+  (elfeed-expose #'elfeed-search-toggle-all 'star))
+
+(defface elfeed-search-mustread-title-face
+  '((t :foreground "red"))
+  "Marks a mustread Elfeed entry.")
+
+(defun my/elfeed-eww-open (&optional use-generic-p)
+  "open with eww"
+  (interactive "P")
+  (let ((entries (elfeed-search-selected)))
+    (cl-loop for entry in entries
+             do (elfeed-untag entry 'unread)
+             when (elfeed-entry-link entry)
+             do (eww-browse-url it))
+    (mapc #'elfeed-search-update-entry entries)
+    (unless (use-region-p) (forward-line))))
+
+
+(defun my/yt-dlp-it (url)
+  "Downloads the URL in an async shell"
+  (let ((default-directory "~/media/videos"))
+    (async-shell-command (format "yt-dlp %s" (shell-quote-argument url)))))
+
+(defun my/elfeed-youtube-dl (&optional use-generic-p)
+  "Youtube-DL link"
+  (interactive "P")
+  (let ((entries (elfeed-search-selected)))
+    (cl-loop for entry in entries
+             do (elfeed-untag entry 'unread)
+             when (elfeed-entry-link entry)
+             do (my/yt-dlp-it it))
+    (mapc #'elfeed-search-update-entry entries)
+    (unless (use-region-p) (forward-line))))
+
+(define-key elfeed-search-mode-map (kbd "d") 'my/elfeed-youtube-dl)
+(define-key elfeed-search-mode-map (kbd "t") 'my/elfeed-eww-open)
+
+(push '(mustread elfeed-search-must-read-title-face) elfeed-search-face-alist)
+
+(provide 'my-elfeed)
+;;; my-elfeed.el ends here
diff --git a/emacs/init.el b/emacs/init.el
index 9c92d65..fced6d5 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -54,6 +54,7 @@
 (require 'my-eshell)
 (require 'my-tramp)
 (require 'my-notmuch)
+(require 'my-elfeed)
 
 (require 'my-buffers)
 (require 'my-git-extra)