69 lines
2.2 KiB
EmacsLisp
69 lines
2.2 KiB
EmacsLisp
;;; rss.el --- RSS feed reading via elfeed -*- lexical-binding: t -*-
|
|
|
|
;; This file is not part of GNU Emacs
|
|
|
|
;; 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:
|
|
|
|
;; commentary
|
|
|
|
;;; Code:
|
|
|
|
;; Elfeed and aggregation setup
|
|
(use-package elfeed
|
|
:config
|
|
(setq elfeed-feeds
|
|
'(;; Planet aggregators
|
|
("https://planet.emacslife.com/atom.xml" planet emacs))))
|
|
|
|
;; This fixes a bug
|
|
(define-advice elfeed-search--header (:around (oldfun &rest args))
|
|
(if elfeed-db
|
|
(apply oldfun args)
|
|
"No database loaded yet"))
|
|
|
|
;; Display the elfeed entry buffer in the main window
|
|
(setq elfeed-show-entry-switch #'elfeed-display-buffer)
|
|
|
|
(defun elfeed-display-buffer (buf &optional act)
|
|
(pop-to-buffer buf)
|
|
(delete-other-main-windows))
|
|
|
|
;; Navigate elfeed entry from the search window
|
|
(defun elfeed-search-show-entry-pre (&optional lines)
|
|
"Returns a function to scroll forward or back in the Elfeed
|
|
search results, displaying entries without switching to them."
|
|
(lambda (times)
|
|
(interactive "p")
|
|
(forward-line (* times (or lines 0)))
|
|
(recenter)
|
|
(call-interactively #'elfeed-search-show-entry)
|
|
(select-window (previous-window))
|
|
(unless elfeed-search-remain-on-entry (forward-line -1))))
|
|
|
|
(define-key elfeed-search-mode-map (kbd "n") (elfeed-search-show-entry-pre +1))
|
|
(define-key elfeed-search-mode-map (kbd "p") (elfeed-search-show-entry-pre -1))
|
|
(define-key elfeed-search-mode-map (kbd "M-RET") (elfeed-search-show-entry-pre))
|
|
|
|
(add-to-list 'display-buffer-alist
|
|
'("\\*elfeed-search\\*"
|
|
(display-buffer-in-side-window)
|
|
(side . top)
|
|
(slot . 0)))
|
|
|
|
(provide 'rss)
|
|
|
|
;;; rss.el ends here
|