summary refs log tree commit diff stats
path: root/lisp/+elfeed.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/+elfeed.el')
-rw-r--r--lisp/+elfeed.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/lisp/+elfeed.el b/lisp/+elfeed.el index 9257c8d..c3e5301 100644 --- a/lisp/+elfeed.el +++ b/lisp/+elfeed.el
@@ -46,20 +46,24 @@ If multiple items are selected, don't advance."
46 (message "[Elfeed] Update in progress") 46 (message "[Elfeed] Update in progress")
47 'ignore) 47 'ignore)
48 48
49(defvar +elfeed--update-running nil "Whether an update is currently running.") 49(defvar +elfeed--update-running-p nil "Whether an update is currently running.")
50(defvar +elfeed--update-count 0 "How many times `+elfeed-update-command' has run.") 50(defvar +elfeed--update-count 0 "How many times `+elfeed-update-command' has run.")
51(defcustom +elfeed-update-niceness 15 51(defcustom +elfeed-update-niceness 15
52 "How \"nice\" `+elfeed-update-command' should be." 52 "How \"nice\" `+elfeed-update-command' should be."
53 :type 'integer 53 :type 'integer
54 :group 'elfeed) 54 :group 'elfeed)
55 55
56(defcustom +elfeed-update-lockfile
57 (expand-file-name "+elfeed-update-lock" (temporary-file-directory))
58 "The file to ")
59
56(defun +elfeed-update-command () 60(defun +elfeed-update-command ()
57 (interactive) 61 (interactive)
58 (unless (or +elfeed--update-running 62 (unless (or +elfeed--update-running-p
59 (derived-mode-p 'elfeed-show-mode 'elfeed-search-mode)) 63 (derived-mode-p 'elfeed-show-mode 'elfeed-search-mode))
60 (let ((script (expand-file-name "/tmp/elfeed-update.el")) 64 (let ((script (expand-file-name "/tmp/elfeed-update.el"))
61 (update-message-format "[Elfeed] Background update: %s")) 65 (update-message-format "[Elfeed] Background update: %s"))
62 (setq +elfeed--update-running t) 66 (setq +elfeed--update-running-p t)
63 (elfeed-db-save) 67 (elfeed-db-save)
64 (advice-add 'elfeed :override #'+elfeed--update-message) 68 (advice-add 'elfeed :override #'+elfeed--update-message)
65 (ignore-errors (kill-buffer "*elfeed-search*")) 69 (ignore-errors (kill-buffer "*elfeed-search*"))
@@ -128,7 +132,7 @@ If multiple items are selected, don't advance."
128 script)) 132 script))
129 (lambda (proc stat) 133 (lambda (proc stat)
130 (advice-remove 'elfeed #'+elfeed--update-message) 134 (advice-remove 'elfeed #'+elfeed--update-message)
131 (setq +elfeed--update-running nil) 135 (setq +elfeed--update-running-p nil)
132 (unless (string= stat "killed") 136 (unless (string= stat "killed")
133 (setq +elfeed--update-count (1+ +elfeed--update-count))) 137 (setq +elfeed--update-count (1+ +elfeed--update-count)))
134 (message update-message-format (string-trim stat))))))) 138 (message update-message-format (string-trim stat)))))))
@@ -152,7 +156,7 @@ non-nil, proceed."
152 156
153(defun +elfeed--cancel-update-timer () 157(defun +elfeed--cancel-update-timer ()
154 "Cancel `+elfeed--update-timer'." 158 "Cancel `+elfeed--update-timer'."
155 (unless +elfeed--update-running 159 (unless +elfeed--update-running-p
156 (ignore-errors (cancel-timer +elfeed--update-timer)) 160 (ignore-errors (cancel-timer +elfeed--update-timer))
157 (setq +elfeed--update-timer nil))) 161 (setq +elfeed--update-timer nil)))
158 162