fix: clean up byte-compiled closures from elfeed-update-hooks

This commit is contained in:
Pavel Korytov 2022-05-03 10:15:52 +03:00
parent 6357eb8b1e
commit 6254cb424e

View file

@ -1072,10 +1072,12 @@ summary buffer."
;; been updated. But it seems impossible to override this hook with ;; been updated. But it seems impossible to override this hook with
;; lexical binding. ;; lexical binding.
;; Thus, this function pushes a closure to the hook and cleans it up ;; Thus, this function pushes a closure to the hook and cleans it up
;; afterwards. ;; afterwards. Also, a closure is occasionally byte-compiled, so
;; this is checked by `byte-code-function-p'.
(setq elfeed-update-hooks (setq elfeed-update-hooks
(seq-filter (lambda (hook) (seq-filter (lambda (hook)
(not (and (listp hook) (eq (car hook) 'closure)))) (not (or (and (listp hook) (eq (car hook) 'closure))
(byte-code-function-p hook))))
elfeed-update-hooks)) elfeed-update-hooks))
(let* ((elfeed--inhibit-update-init-hooks t) (let* ((elfeed--inhibit-update-init-hooks t)
(remaining-feeds (elfeed-feed-list)) (remaining-feeds (elfeed-feed-list))
@ -1095,7 +1097,8 @@ summary buffer."
(when (seq-empty-p remaining-feeds) (when (seq-empty-p remaining-feeds)
(setq elfeed-update-hooks (setq elfeed-update-hooks
(seq-filter (lambda (hook) (seq-filter (lambda (hook)
(not (and (listp hook) (eq (car hook) 'closure)))) (not (or (and (listp hook) (eq (car hook) 'closure))
(byte-code-function-p hook))))
elfeed-update-hooks))) elfeed-update-hooks)))
(when (or (seq-empty-p remaining-feeds) (when (or (seq-empty-p remaining-feeds)
elfeed-summary-refresh-on-each-update) elfeed-summary-refresh-on-each-update)