From cb9c009557b956b4814f1c4294f70bf38d1f0d53 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sat, 3 Sep 2022 21:08:20 +0800 Subject: elfeed: cleanup and add some feeds * elfeed-conf.el (elfeed-feeds): Add some feeds of Rust blogs. (elfeed-search-mode-map, durand-elfeed-show-hook, elfeed-show-refresh): Enable olivetti-mode when reading elfeed entries, and tell shr to use the appropriate body width when rendering HTML content. (elfeed-display-buffer, durand-elfeed-kill-buffer): Clean something up. --- elfeed-conf.el | 47 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/elfeed-conf.el b/elfeed-conf.el index a683931..26a5d51 100644 --- a/elfeed-conf.el +++ b/elfeed-conf.el @@ -27,6 +27,8 @@ (use-package "elfeed" 'elfeed) +;;; All feeds + (setq elfeed-feeds (list (list "https://blog.tanyakhovanova.com/feed/" 'math 'khovanova 'blog) @@ -53,38 +55,65 @@ ;; (list "https://www.youtube.com/feeds/videos.xml?channel_id=UCiWXd0nmBjlKROwzMyPV-Nw" ;; 'zhichi 'youtube) (list "https://blog.rust-lang.org/feed.xml" - 'rust 'blog) + 'rust 'blog 'official) (list "https://sachachua.com/blog/feed/" 'sacha 'emacs 'blog) + (list "https://deterministic.space/feed.xml" + 'pascal 'rust 'blog 'fun) + (list "https://fasterthanli.me/index.xml" + 'amos 'rust 'blog 'lang) ;; (list "https://www.youtube.com/feeds/videos.xml?channel_id=UCPtfAE6_21oqjO7Bh2bJcog" ;; 'teukkaniikka 'arduino) )) -(define-key elfeed-search-mode-map (vector #x78) 'elfeed-search-exit) - ;;; Default search filter (setq elfeed-search-filter "@6-months-ago +emacs") -;; I still prefer the defaults. +;;; Show mode hook + +(defun durand-elfeed-show-hook (fun &rest arg) + "Do some set-ups so that I can be happier." + (require 'olivetti) + (olivetti-mode 1) + (let ((shr-width olivetti-body-width)) + (apply fun arg))) + +(advice-add #'elfeed-show-refresh :around #'durand-elfeed-show-hook) + + +;;; switching and deleting (setq elfeed-show-entry-switch #'switch-to-buffer) (setq elfeed-show-entry-delete #'elfeed-kill-buffer) +;;; A custom buffer displayer, deprecated + ;;;###autoload (defun elfeed-display-buffer (buffer) "Display BUFFER in the bottom window." - (display-buffer buffer - '(display-buffer-reuse-mode-window display-buffer-at-bottom))) + (declare (obsolete + switch-to-buffer + "2022-09-03 20:03:53.599131T+28800")) + (display-buffer + buffer + '(display-buffer-reuse-mode-window display-buffer-at-bottom))) + +;;; A custom buffer killer, deprecated ;;;###autoload (defun durand-elfeed-kill-buffer () "Kill the buffer and delete its window." + (declare (obsolete + elfeed-kill-buffer + "2022-09-03 20:07:01.801648T+28800")) (kill-buffer (current-buffer)) (cond ((one-window-p)) ((delete-window (get-buffer-window (current-buffer)))))) +;;; Exit elfeed + ;;;###autoload (defun elfeed-search-exit () "Save the database, then kill all related buffers." @@ -97,6 +126,10 @@ (kill-buffer buffer))))) (buffer-list))) +(define-key elfeed-search-mode-map (vector #x78) 'elfeed-search-exit) + +;;; Download / play the video in the feed + ;;;###autoload (defun durand-elfeed-play-video (process) "Play the video file downloaded by PROCESS." @@ -154,7 +187,7 @@ This informs the user when STATUS is the string \"finished\\n\"." ((and (string= status "finished\n") (y-or-n-p "Play video?")) (durand-elfeed-play-video process)))) - + ;;;###autoload (defun durand-eshell-download-filter (process output) "Display OUTPUT in the buffer associated with PROCESS. -- cgit v1.2.3-18-g5258