commit c5595732458a9614697d0e7cb07b3a0b16e40a4f parent 9f591fda0f4d01118490b9a9551066409722c7e5 Author: Yuval Langer <yuval.langer@gmail.com> Date: Sat, 4 Nov 2023 01:20:32 +0200 Move values into defvars. Maybe not change an Elfeed global variable in the update function. Diffstat:
M | elfeed-nitter.el | | | 39 | ++++++++++++++++++++------------------- |
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/elfeed-nitter.el b/elfeed-nitter.el @@ -22,6 +22,10 @@ (defvar elfeed-nitter-path (locate-user-emacs-file "elfeed-nitter/")) +(defvar elfeed-nitter-wiki-path + (concat elfeed-nitter-path + "nitter-wiki/")) + (defvar elfeed-nitter-instances-list-path (concat elfeed-nitter-path "nitter-wiki/Instances.md")) @@ -67,30 +71,26 @@ rest-of-the-tags)))))) (defun elfeed-nitter-update-random-instances () - (let ((elfeed-feeds elfeed-feeds)) + (let* ((old-elfeed-feeds elfeed-feeds) + elfeed-feeds) (setq elfeed-feeds - (append elfeed-feeds + (append old-elfeed-feeds (elfeed-nitter-make-random-feeds-alist))) (elfeed-update))) (defun elfeed-nitter--clone-nitter-wiki () - (let* ((elfeed-nitter-path (locate-user-emacs-file "elfeed-nitter/")) - (nitter-wiki-path (concat elfeed-nitter-path - "nitter-wiki/"))) - (ignore-error 'file-already-exists - (make-directory elfeed-nitter-path)) - (shell-command-to-string (concat "git clone https://github.com/zedeus/nitter.wiki.git " - nitter-wiki-path)))) + (ignore-error 'file-already-exists + (make-directory elfeed-nitter-path)) + (shell-command-to-string (format "git clone %s %s" + elfeed-nitter-wiki-url + elfeed-nitter-wiki-path))) (defun elfeed-nitter--update-nitter-wiki () - (let* ((elfeed-nitter-path (locate-user-emacs-file "elfeed-nitter/")) - (nitter-wiki-path (concat elfeed-nitter-path - "nitter-wiki/"))) - (ignore-error 'file-already-exists - (make-directory elfeed-nitter-path)) - (let ((default-directory nitter-wiki-path)) - (shell-command-to-string (format "git pull --ff-only %s" - "https://github.com/zedeus/nitter.wiki.git"))))) + (ignore-error 'file-already-exists + (make-directory elfeed-nitter-path)) + (let ((default-directory elfeed-nitter-wiki-path)) + (shell-command-to-string (format "git pull --ff-only %s" + elfeed-nitter-wiki-url)))) (defun elfeed-nitter-make-instances-hosts-list () (cl-loop @@ -114,7 +114,8 @@ line) collect - (let* ((uri-string (replace-regexp-in-string "|\s*\\[.*\\](\\(.*\\)).*white_check_mark:\s*|\s*:white_check_mark.*" "\\1" - line)) + (let* ((uri-string (replace-regexp-in-string + "|\s*\\[.*\\](\\(.*\\)).*white_check_mark:\s*|\s*:white_check_mark.*" "\\1" + line)) (uri-object (url-generic-parse-url uri-string))) (url-host uri-object))))