;;; app/rss/autoload.el ;;;###autoload (defun =rss () "Activate (or switch to) `elfeed' in its workspace." (interactive) (call-interactively 'elfeed)) ;;;###autoload (defun +rss/quit () (interactive) (doom-kill-matching-buffers "^\\*elfeed") (dolist (file +rss-elfeed-files) (when-let (buf (get-file-buffer (expand-file-name file +rss-org-dir))) (kill-buffer buf)))) ;;;###autoload (defun +rss|elfeed-wrap () "Enhances an elfeed entry's readability by wrapping it to a width of `fill-column' and centering it with `visual-fill-column-mode'." (let ((inhibit-read-only t) (inhibit-modification-hooks t)) (setq-local truncate-lines nil) (setq-local shr-width 85) (set-buffer-modified-p nil))) ;;;###autoload (defun +rss/delete-pane () "Delete the *elfeed-entry* split pane." (interactive) (let* ((buff (get-buffer "*elfeed-entry*")) (window (get-buffer-window buff))) (kill-buffer buff) (delete-window window))) ;;;###autoload (defun +rss-popup-pane (buf) "Display BUF in a popup." (doom-popup-buffer buf :align +rss-split-direction :size 0.75 :select t :noesc t :autokill t)) ;;;###autoload (defun +rss/open (entry) "Display the currently selected item in a buffer." (interactive (list (elfeed-search-selected :ignore-region))) (when (elfeed-entry-p entry) (elfeed-untag entry 'unread) (elfeed-search-update-entry entry) (elfeed-show-entry entry))) ;;;###autoload (defun +rss/next () "Show the next item in the elfeed-search buffer." (interactive) (funcall elfeed-show-entry-delete) (with-current-buffer (elfeed-search-buffer) (forward-line) (call-interactively '+rss/open))) ;;;###autoload (defun +rss/previous () "Show the previous item in the elfeed-search buffer." (interactive) (funcall elfeed-show-entry-delete) (with-current-buffer (elfeed-search-buffer) (forward-line -1) (call-interactively '+rss/open))) ;;;###autoload (defun +rss-dead-feeds (&optional years) "Return a list of feeds that haven't posted anything in YEARS." (let* ((years (or years 1.0)) (living-feeds (make-hash-table :test 'equal)) (seconds (* years 365.0 24 60 60)) (threshold (- (float-time) seconds))) (with-elfeed-db-visit (entry feed) (let ((date (elfeed-entry-date entry))) (when (> date threshold) (setf (gethash (elfeed-feed-url feed) living-feeds) t)))) (cl-loop for url in (elfeed-feed-list) unless (gethash url living-feeds) collect url)))