From 0f3cec97beed31b905ae37745dc2bb28e3a62c91 Mon Sep 17 00:00:00 2001 From: Emmet Date: Wed, 4 Oct 2023 21:03:40 -0500 Subject: [PATCH] Freshrss-elfeed sync improvements + fix for auto-categories --- user/app/doom-emacs/config.el | 16 +++++++++++++--- user/app/doom-emacs/doom.org | 17 +++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/user/app/doom-emacs/config.el b/user/app/doom-emacs/config.el index b596495..02302df 100644 --- a/user/app/doom-emacs/config.el +++ b/user/app/doom-emacs/config.el @@ -899,9 +899,6 @@ tasks." (defun org-categorize-by-roam-db-on-save () (interactive) - (when - (string-prefix-p (concat "/home/" user-username "/Org") (expand-file-name (buffer-file-name))) - (org-set-property "CATEGORY" (substring (string-trim-left (expand-file-name (buffer-file-name)) (concat "/home/" user-username "/Org/")) 0 (string-match "/" (string-trim-left (expand-file-name (buffer-file-name)) (concat "/home/" user-username "/Org/"))))) (when (string= (message "%s" major-mode) "org-mode") (when (string-prefix-p (concat "/home/" user-username "/Org") (expand-file-name (buffer-file-name))) @@ -1232,6 +1229,7 @@ https://github.com/magit/magit/issues/460 (@cpitclaudel)." ;;(setq elfeed-use-curl t) ;;(setq elfeed-set-timeout 36000) ;;(setq elfeed-log-level 'debug) +;;(setq freshrss-hostname "https://freshrss.example.com") ;;(setq elfeed-feeds (list ;; (list "fever+https://user@freshrss.example.com" ;; :api-url "https://user@freshrss.example.com/api/fever.php" @@ -1245,8 +1243,20 @@ https://github.com/magit/magit/issues/460 (@cpitclaudel)." ("odcyn.com" . browse-url-chrome) ("tilvids.com" . browse-url-chrome))) (map! :leader :desc "Open elfeed" "O n" #'elfeed) + +(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-update)) (map! :map 'elfeed-search-mode-map :desc "Update elfeed" :n "g R" #'elfeed-full-update) diff --git a/user/app/doom-emacs/doom.org b/user/app/doom-emacs/doom.org index 650e930..13802d9 100644 --- a/user/app/doom-emacs/doom.org +++ b/user/app/doom-emacs/doom.org @@ -1052,9 +1052,6 @@ On Wayland, EAF doesn't work. (defun org-categorize-by-roam-db-on-save () (interactive) - (when - (string-prefix-p (concat "/home/" user-username "/Org") (expand-file-name (buffer-file-name))) - (org-set-property "CATEGORY" (substring (string-trim-left (expand-file-name (buffer-file-name)) (concat "/home/" user-username "/Org/")) 0 (string-match "/" (string-trim-left (expand-file-name (buffer-file-name)) (concat "/home/" user-username "/Org/"))))) (when (string= (message "%s" major-mode) "org-mode") (when (string-prefix-p (concat "/home/" user-username "/Org") (expand-file-name (buffer-file-name))) @@ -1482,6 +1479,7 @@ EAF doesn't work on Wayland :( ;;(setq elfeed-use-curl t) ;;(setq elfeed-set-timeout 36000) ;;(setq elfeed-log-level 'debug) +;;(setq freshrss-hostname "https://freshrss.example.com") ;;(setq elfeed-feeds (list ;; (list "fever+https://user@freshrss.example.com" ;; :api-url "https://user@freshrss.example.com/api/fever.php" @@ -1495,8 +1493,20 @@ EAF doesn't work on Wayland :( ("odcyn.com" . browse-url-chrome) ("tilvids.com" . browse-url-chrome))) (map! :leader :desc "Open elfeed" "O n" #'elfeed) + +(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-update)) (map! :map 'elfeed-search-mode-map :desc "Update elfeed" :n "g R" #'elfeed-full-update) @@ -1732,7 +1742,6 @@ Any git package can be configured for a particular commit or branch: (package! async) (package! centered-cursor-mode) (package! elfeed) -(package! elfeed) (package! elfeed-protocol) #+END_SRC * Nix Integration