summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--early-init.el24
-rw-r--r--lisp/+elfeed.el115
2 files changed, 70 insertions, 69 deletions
diff --git a/early-init.el b/early-init.el index 40edbe5..8ceb74f 100644 --- a/early-init.el +++ b/early-init.el
@@ -76,18 +76,18 @@ See `no-littering' for examples.")
76 76
77;;; Fonts 77;;; Fonts
78(+with-ensure-after-init 78(+with-ensure-after-init
79 ;; Set default faces 79 (unless noninteractive ;; Set default faces
80 (+with-message "Setting default faces" 80 (+with-message "Setting default faces"
81 (let ((font-name machine-default-font) 81 (let ((font-name machine-default-font)
82 (font-size machine-default-height) 82 (font-size machine-default-height)
83 (variable-font-name machine-variable-pitch-font) 83 (variable-font-name machine-variable-pitch-font)
84 (variable-font-size machine-variable-pitch-height)) 84 (variable-font-size machine-variable-pitch-height))
85 (set-face-attribute 'default nil :family font-name 85 (set-face-attribute 'default nil :family font-name
86 :height font-size :weight 'book) 86 :height font-size :weight 'book)
87 (set-face-attribute 'italic nil :family font-name 87 (set-face-attribute 'italic nil :family font-name
88 :height font-size :slant 'italic) 88 :height font-size :slant 'italic)
89 (set-face-attribute 'variable-pitch nil :family variable-font-name 89 (set-face-attribute 'variable-pitch nil :family variable-font-name
90 :height variable-font-size))) 90 :height variable-font-size))))
91 91
92 ;; Emoji fonts 92 ;; Emoji fonts
93 (+with-message "Adding emoji fonts" 93 (+with-message "Adding emoji fonts"
diff --git a/lisp/+elfeed.el b/lisp/+elfeed.el index b2a578b..82db471 100644 --- a/lisp/+elfeed.el +++ b/lisp/+elfeed.el
@@ -40,63 +40,64 @@
40 40
41(defun +elfeed-update-command () 41(defun +elfeed-update-command ()
42 (interactive) 42 (interactive)
43 (let ((script (expand-file-name "~/.local/bin/elfeed")) 43 (let ((script (expand-file-name "~/.local/bin/elfeed-update.el"))
44 (update-message-format "[Elfeed] Updating in the background...%s")) 44 (update-message-format "[Elfeed] Updating in the background..."))
45 (message update-message-format "") 45 (with-temp-message update-message-format
46 (setq +elfeed--update-running t) 46 (setq +elfeed--update-running t)
47 (elfeed-db-save) 47 (elfeed-db-save)
48 (advice-add 'elfeed :override #'+elfeed--update-message) 48 (advice-add 'elfeed :override #'+elfeed--update-message)
49 (ignore-errors (kill-buffer "*elfeed-search*")) 49 (ignore-errors (kill-buffer "*elfeed-search*"))
50 (ignore-errors (kill-buffer "*elfeed-log*")) 50 (ignore-errors (kill-buffer "*elfeed-log*"))
51 (elfeed-db-unload) 51 (elfeed-db-unload)
52 (unless (file-exists-p script) 52 (unless (file-exists-p script)
53 (make-directory (file-name-directory script) :parents) 53 (make-directory (file-name-directory script) :parents)
54 (with-temp-buffer 54 (with-temp-buffer
55 (insert 55 (insert
56 (nconcat nil 56 (nconcat nil
57 "#!/usr/bin/env -S emacs --script" 57 "#!/usr/bin/env -S emacs --script"
58 ;; I have to load the necessary files 58 "(setq lexical-binding t)"
59 "(load (locate-user-emacs-file \"early-init\"))" 59 ;; I have to load the necessary files
60 "(straight-use-package 'elfeed)" 60 "(load (locate-user-emacs-file \"early-init\"))"
61 "(straight-use-package 'elfeed-org)" 61 "(straight-use-package 'elfeed)"
62 "(require 'elfeed)" 62 "(straight-use-package 'elfeed-org)"
63 "(require 'elfeed-org)" 63 "(require 'elfeed)"
64 ;; And set needed variables 64 "(require 'elfeed-org)"
65 `("(setq rmh-elfeed-org-files '(" 65 ;; And set needed variables
66 ,(mapconcat (lambda (el) 66 `("(setq rmh-elfeed-org-files '("
67 (format "\"%s\"" el)) 67 ,(mapconcat (lambda (el)
68 rmh-elfeed-org-files 68 (format "\"%s\"" el))
69 " ") 69 rmh-elfeed-org-files
70 "))") 70 " ")
71 ;; Overwrite log function to go to stdout 71 "))")
72 "(defun elfeed-log (level fmt &rest objects)" 72 ;; Overwrite log function to go to stdout
73 " (princ (format \"[%s] [%s]: %s\\n\"" 73 "(defun elfeed-log (level fmt &rest objects)"
74 " (format-time-string \"%F %T\")" 74 " (princ (format \"[%s] [%s]: %s\\n\""
75 " level" 75 " (format-time-string \"%F %T\")"
76 " (apply #'format fmt objects))))" 76 " level"
77 ;; Load elfeed 77 " (apply #'format fmt objects))))"
78 "(elfeed-org)" 78 ;; Load elfeed
79 "(elfeed-db-load)" 79 "(elfeed-org)"
80 "(elfeed)" 80 "(elfeed-db-load)"
81 ;; Update elfeed 81 "(elfeed)"
82 "(elfeed-update)" 82 ;; Update elfeed
83 ;; Wait to finish ... I think. 83 "(elfeed-update)"
84 "(while (> (elfeed-queue-count-total) 0)" 84 ;; Wait to finish ... I think.
85 " (sleep-for 5)" 85 "(while (> (elfeed-queue-count-total) 0)"
86 " (message \"%s\" (elfeed-queue-count-total))" 86 " (sleep-for 5)"
87 " (accept-process-output))" 87 " (message \"%s\" (elfeed-queue-count-total))"
88 ;; Save and garbage-collect 88 " (accept-process-output))"
89 "(elfeed-db-save)" 89 ;; Save and garbage-collect
90 "(elfeed-db-gc)")) 90 "(elfeed-db-save)"
91 (write-file script)) 91 "(elfeed-db-gc)"))
92 (chmod script #o777)) 92 (write-file script))
93 (set-process-sentinel (start-process-shell-command 93 (chmod script #o777))
94 "Elfeed" nil script) 94 (set-process-sentinel (start-process-shell-command
95 (lambda (a b) 95 "Elfeed" nil script)
96 (advice-remove 'elfeed #'+elfeed--update-message) 96 (lambda (a b)
97 (setq +elfeed--update-running nil) 97 (advice-remove 'elfeed #'+elfeed--update-message)
98 (message update-message-format 98 (setq +elfeed--update-running nil)
99 (string-trim b)))))) 99 (message update-message-format
100 (string-trim b)))))))
100 101
101(defvar +elfeed--update-timer nil "Timer for `elfeed-update-command'.") 102(defvar +elfeed--update-timer nil "Timer for `elfeed-update-command'.")
102(defvar +elfeed--update-first-time 6 "How long to wait for the first time.") 103(defvar +elfeed--update-first-time 6 "How long to wait for the first time.")