Update elfeed-update.el
This commit is contained in:
parent
81fb787be4
commit
00f639319c
|
@ -76,18 +76,18 @@ See `no-littering' for examples.")
|
||||||
|
|
||||||
;;; Fonts
|
;;; Fonts
|
||||||
(+with-ensure-after-init
|
(+with-ensure-after-init
|
||||||
;; Set default faces
|
(unless noninteractive ;; Set default faces
|
||||||
(+with-message "Setting default faces"
|
(+with-message "Setting default faces"
|
||||||
(let ((font-name machine-default-font)
|
(let ((font-name machine-default-font)
|
||||||
(font-size machine-default-height)
|
(font-size machine-default-height)
|
||||||
(variable-font-name machine-variable-pitch-font)
|
(variable-font-name machine-variable-pitch-font)
|
||||||
(variable-font-size machine-variable-pitch-height))
|
(variable-font-size machine-variable-pitch-height))
|
||||||
(set-face-attribute 'default nil :family font-name
|
(set-face-attribute 'default nil :family font-name
|
||||||
:height font-size :weight 'book)
|
:height font-size :weight 'book)
|
||||||
(set-face-attribute 'italic nil :family font-name
|
(set-face-attribute 'italic nil :family font-name
|
||||||
:height font-size :slant 'italic)
|
:height font-size :slant 'italic)
|
||||||
(set-face-attribute 'variable-pitch nil :family variable-font-name
|
(set-face-attribute 'variable-pitch nil :family variable-font-name
|
||||||
:height variable-font-size)))
|
:height variable-font-size))))
|
||||||
|
|
||||||
;; Emoji fonts
|
;; Emoji fonts
|
||||||
(+with-message "Adding emoji fonts"
|
(+with-message "Adding emoji fonts"
|
||||||
|
|
115
lisp/+elfeed.el
115
lisp/+elfeed.el
|
@ -40,63 +40,64 @@
|
||||||
|
|
||||||
(defun +elfeed-update-command ()
|
(defun +elfeed-update-command ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((script (expand-file-name "~/.local/bin/elfeed"))
|
(let ((script (expand-file-name "~/.local/bin/elfeed-update.el"))
|
||||||
(update-message-format "[Elfeed] Updating in the background...%s"))
|
(update-message-format "[Elfeed] Updating in the background..."))
|
||||||
(message update-message-format "")
|
(with-temp-message update-message-format
|
||||||
(setq +elfeed--update-running t)
|
(setq +elfeed--update-running t)
|
||||||
(elfeed-db-save)
|
(elfeed-db-save)
|
||||||
(advice-add 'elfeed :override #'+elfeed--update-message)
|
(advice-add 'elfeed :override #'+elfeed--update-message)
|
||||||
(ignore-errors (kill-buffer "*elfeed-search*"))
|
(ignore-errors (kill-buffer "*elfeed-search*"))
|
||||||
(ignore-errors (kill-buffer "*elfeed-log*"))
|
(ignore-errors (kill-buffer "*elfeed-log*"))
|
||||||
(elfeed-db-unload)
|
(elfeed-db-unload)
|
||||||
(unless (file-exists-p script)
|
(unless (file-exists-p script)
|
||||||
(make-directory (file-name-directory script) :parents)
|
(make-directory (file-name-directory script) :parents)
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert
|
(insert
|
||||||
(nconcat nil
|
(nconcat nil
|
||||||
"#!/usr/bin/env -S emacs --script"
|
"#!/usr/bin/env -S emacs --script"
|
||||||
;; I have to load the necessary files
|
"(setq lexical-binding t)"
|
||||||
"(load (locate-user-emacs-file \"early-init\"))"
|
;; I have to load the necessary files
|
||||||
"(straight-use-package 'elfeed)"
|
"(load (locate-user-emacs-file \"early-init\"))"
|
||||||
"(straight-use-package 'elfeed-org)"
|
"(straight-use-package 'elfeed)"
|
||||||
"(require 'elfeed)"
|
"(straight-use-package 'elfeed-org)"
|
||||||
"(require 'elfeed-org)"
|
"(require 'elfeed)"
|
||||||
;; And set needed variables
|
"(require 'elfeed-org)"
|
||||||
`("(setq rmh-elfeed-org-files '("
|
;; And set needed variables
|
||||||
,(mapconcat (lambda (el)
|
`("(setq rmh-elfeed-org-files '("
|
||||||
(format "\"%s\"" el))
|
,(mapconcat (lambda (el)
|
||||||
rmh-elfeed-org-files
|
(format "\"%s\"" el))
|
||||||
" ")
|
rmh-elfeed-org-files
|
||||||
"))")
|
" ")
|
||||||
;; Overwrite log function to go to stdout
|
"))")
|
||||||
"(defun elfeed-log (level fmt &rest objects)"
|
;; Overwrite log function to go to stdout
|
||||||
" (princ (format \"[%s] [%s]: %s\\n\""
|
"(defun elfeed-log (level fmt &rest objects)"
|
||||||
" (format-time-string \"%F %T\")"
|
" (princ (format \"[%s] [%s]: %s\\n\""
|
||||||
" level"
|
" (format-time-string \"%F %T\")"
|
||||||
" (apply #'format fmt objects))))"
|
" level"
|
||||||
;; Load elfeed
|
" (apply #'format fmt objects))))"
|
||||||
"(elfeed-org)"
|
;; Load elfeed
|
||||||
"(elfeed-db-load)"
|
"(elfeed-org)"
|
||||||
"(elfeed)"
|
"(elfeed-db-load)"
|
||||||
;; Update elfeed
|
"(elfeed)"
|
||||||
"(elfeed-update)"
|
;; Update elfeed
|
||||||
;; Wait to finish ... I think.
|
"(elfeed-update)"
|
||||||
"(while (> (elfeed-queue-count-total) 0)"
|
;; Wait to finish ... I think.
|
||||||
" (sleep-for 5)"
|
"(while (> (elfeed-queue-count-total) 0)"
|
||||||
" (message \"%s\" (elfeed-queue-count-total))"
|
" (sleep-for 5)"
|
||||||
" (accept-process-output))"
|
" (message \"%s\" (elfeed-queue-count-total))"
|
||||||
;; Save and garbage-collect
|
" (accept-process-output))"
|
||||||
"(elfeed-db-save)"
|
;; Save and garbage-collect
|
||||||
"(elfeed-db-gc)"))
|
"(elfeed-db-save)"
|
||||||
(write-file script))
|
"(elfeed-db-gc)"))
|
||||||
(chmod script #o777))
|
(write-file script))
|
||||||
(set-process-sentinel (start-process-shell-command
|
(chmod script #o777))
|
||||||
"Elfeed" nil script)
|
(set-process-sentinel (start-process-shell-command
|
||||||
(lambda (a b)
|
"Elfeed" nil script)
|
||||||
(advice-remove 'elfeed #'+elfeed--update-message)
|
(lambda (a b)
|
||||||
(setq +elfeed--update-running nil)
|
(advice-remove 'elfeed #'+elfeed--update-message)
|
||||||
(message update-message-format
|
(setq +elfeed--update-running nil)
|
||||||
(string-trim b))))))
|
(message update-message-format
|
||||||
|
(string-trim b)))))))
|
||||||
|
|
||||||
(defvar +elfeed--update-timer nil "Timer for `elfeed-update-command'.")
|
(defvar +elfeed--update-timer nil "Timer for `elfeed-update-command'.")
|
||||||
(defvar +elfeed--update-first-time 6 "How long to wait for the first time.")
|
(defvar +elfeed--update-first-time 6 "How long to wait for the first time.")
|
||||||
|
|
Loading…
Reference in New Issue