Freshrss-elfeed sync improvements + fix for auto-categories

This commit is contained in:
Emmet 2023-10-04 21:03:40 -05:00
parent 5028670aab
commit 0f3cec97be
2 changed files with 26 additions and 7 deletions

View file

@ -899,9 +899,6 @@ tasks."
(defun org-categorize-by-roam-db-on-save () (defun org-categorize-by-roam-db-on-save ()
(interactive) (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= (message "%s" major-mode) "org-mode")
(when (when
(string-prefix-p (concat "/home/" user-username "/Org") (expand-file-name (buffer-file-name))) (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-use-curl t)
;;(setq elfeed-set-timeout 36000) ;;(setq elfeed-set-timeout 36000)
;;(setq elfeed-log-level 'debug) ;;(setq elfeed-log-level 'debug)
;;(setq freshrss-hostname "https://freshrss.example.com")
;;(setq elfeed-feeds (list ;;(setq elfeed-feeds (list
;; (list "fever+https://user@freshrss.example.com" ;; (list "fever+https://user@freshrss.example.com"
;; :api-url "https://user@freshrss.example.com/api/fever.php" ;; :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) ("odcyn.com" . browse-url-chrome)
("tilvids.com" . browse-url-chrome))) ("tilvids.com" . browse-url-chrome)))
(map! :leader :desc "Open elfeed" "O n" #'elfeed) (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 () (defun elfeed-full-update ()
(interactive) (interactive)
(if (freshrss-network-connection-p) (delete-directory "~/.cache/doom/elfeed" t))
(setq elfeed-db nil)
(elfeed-protocol-fever-update main-elfeed-feed) (elfeed-protocol-fever-update main-elfeed-feed)
(elfeed-update)) (elfeed-update))
(map! :map 'elfeed-search-mode-map :desc "Update elfeed" :n "g R" #'elfeed-full-update) (map! :map 'elfeed-search-mode-map :desc "Update elfeed" :n "g R" #'elfeed-full-update)

View file

@ -1052,9 +1052,6 @@ On Wayland, EAF doesn't work.
(defun org-categorize-by-roam-db-on-save () (defun org-categorize-by-roam-db-on-save ()
(interactive) (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= (message "%s" major-mode) "org-mode")
(when (when
(string-prefix-p (concat "/home/" user-username "/Org") (expand-file-name (buffer-file-name))) (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-use-curl t)
;;(setq elfeed-set-timeout 36000) ;;(setq elfeed-set-timeout 36000)
;;(setq elfeed-log-level 'debug) ;;(setq elfeed-log-level 'debug)
;;(setq freshrss-hostname "https://freshrss.example.com")
;;(setq elfeed-feeds (list ;;(setq elfeed-feeds (list
;; (list "fever+https://user@freshrss.example.com" ;; (list "fever+https://user@freshrss.example.com"
;; :api-url "https://user@freshrss.example.com/api/fever.php" ;; :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) ("odcyn.com" . browse-url-chrome)
("tilvids.com" . browse-url-chrome))) ("tilvids.com" . browse-url-chrome)))
(map! :leader :desc "Open elfeed" "O n" #'elfeed) (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 () (defun elfeed-full-update ()
(interactive) (interactive)
(if (freshrss-network-connection-p) (delete-directory "~/.cache/doom/elfeed" t))
(setq elfeed-db nil)
(elfeed-protocol-fever-update main-elfeed-feed) (elfeed-protocol-fever-update main-elfeed-feed)
(elfeed-update)) (elfeed-update))
(map! :map 'elfeed-search-mode-map :desc "Update elfeed" :n "g R" #'elfeed-full-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! async)
(package! centered-cursor-mode) (package! centered-cursor-mode)
(package! elfeed) (package! elfeed)
(package! elfeed)
(package! elfeed-protocol) (package! elfeed-protocol)
#+END_SRC #+END_SRC
* Nix Integration * Nix Integration