From 2886853a722b1f3a6db5419a3d191b96419cfde8 Mon Sep 17 00:00:00 2001 From: Emmet Date: Wed, 26 Jun 2024 16:06:19 -0500 Subject: [PATCH] Finally got two-way freshrss-elfeed syncing --- user/app/doom-emacs/config.el | 20 +++++++------------- user/app/doom-emacs/doom.org | 21 ++++++++------------- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/user/app/doom-emacs/config.el b/user/app/doom-emacs/config.el index 91849f2..b509fe6 100644 --- a/user/app/doom-emacs/config.el +++ b/user/app/doom-emacs/config.el @@ -1562,19 +1562,13 @@ https://github.com/magit/magit/issues/460 (@cpitclaudel)." (map! :leader :desc "Open elfeed" "O n" #'elfeed) (map! :map 'elfeed-search-mode-map :desc "Open url" :n "g o" #'elfeed-search-browse-url) -(defun freshrss-network-connection-p () - (not (condition-case nil - (delete-process - (make-network-process - :name freshrss-hostname - :host "elpa.gnu.org" - :service 443)) - (error t)))) - (defun elfeed-full-update () (interactive) - (if (freshrss-network-connection-p) (delete-directory "~/.cache/doom/elfeed" t)) - (setq elfeed-db nil) - (elfeed-protocol-fever-update main-elfeed-feed) + (elfeed-search-update--force) + (cl-loop for entry in elfeed-search-entries + do (elfeed-untag-1 entry 'unread)) + (elfeed-protocol-fever-reinit freshrss-hostname) (elfeed-update)) -(map! :map 'elfeed-search-mode-map :desc "Update elfeed" :n "g R" #'elfeed-full-update) + +(add-hook 'elfeed-search-mode-hook 'elfeed-full-update) +(add-hook 'elfeed-search-update-hook (lambda () (goto-char (point-min)))) diff --git a/user/app/doom-emacs/doom.org b/user/app/doom-emacs/doom.org index ccb32bc..433b090 100644 --- a/user/app/doom-emacs/doom.org +++ b/user/app/doom-emacs/doom.org @@ -1836,22 +1836,17 @@ I don't have this active right now since it's kinda weird with pgtk... (map! :leader :desc "Open elfeed" "O n" #'elfeed) (map! :map 'elfeed-search-mode-map :desc "Open url" :n "g o" #'elfeed-search-browse-url) -(defun freshrss-network-connection-p () - (not (condition-case nil - (delete-process - (make-network-process - :name freshrss-hostname - :host "elpa.gnu.org" - :service 443)) - (error t)))) - (defun elfeed-full-update () (interactive) - (if (freshrss-network-connection-p) (delete-directory "~/.cache/doom/elfeed" t)) - (setq elfeed-db nil) - (elfeed-protocol-fever-update main-elfeed-feed) + (elfeed-search-update--force) + (cl-loop for entry in elfeed-search-entries + do (elfeed-untag-1 entry 'unread)) + (elfeed-protocol-fever-reinit freshrss-hostname) (elfeed-update)) -(map! :map 'elfeed-search-mode-map :desc "Update elfeed" :n "g R" #'elfeed-full-update) + +(add-hook 'elfeed-search-mode-hook 'elfeed-full-update) +(add-hook 'elfeed-search-update-hook (lambda () (goto-char (point-min)))) + #+END_SRC * My init.el