ITADN

Elfeed-org fails to populate elfeed-feeds variable when (use-package elfeed-org :defer t)

#95Openstottm 创建于 2024-08-07
S
stottmcommented
There are a lot of people instructing newbies to defer loading of all packages. That is bad advice. I have discovered an issue described below that could be considered user configuration error. This is not a bug. However, this behavior should be documented in the README at least. Add a recommended use-package configuration for elfeed & elfeed-org. While you can defer load elfeed itself, if you attempt to also defer load elfeed-org, it will not populate the variable elfeed-feeds with the org file listing of feeds which means elfeed cannot update the feeds as it cannot see the feeds. Turning off deferral on elfeed-org resulted in increased start times but resolved the problem with elfeed not updating feeds. Re-examining use-package docs and reviewing Prot's recent [use-package video](https://www.youtube.com/watch?v=RaqtzemHFDU), I've come up with a solution. Utilizing the following works for me (I am no expert) and reduced startup time for elfeed-org from 0.42 to 0.01 (YMMV) as measured by use-package-report and resulted in an overall reduced startup time of approximately a tenth of a second (every little bit counts towards the total). ```emacs-lisp (use-package elfeed :defer t :bind ("C-c e" . elfeed)) (use-package elfeed-org :after (elfeed) :config (elfeed-org) (setq rmh-elfeed-org-files (list "~/.config/emacs/elfeed.org"))) ``` You can enable use-package statistics in your init.el so you can benchmark load times of packages. ```emacs-lisp (setq use-package-compute-statistics t) ;; Review metrics M-x use-package-report ``` You can also enable printing the Emacs load time at every startup. ```emacs-lisp ;; Reset variables, and new startup message (add-hook 'emacs-startup-hook (lambda () ;; Reset the file handler list (setq file-name-handler-alist pure-file-name-handler-alist) ;; Reset garbage collection (setq gc-cons-threshold 2000000) ;; Startup time message (message (format "Emacs ready in %.5f seconds with %d garbage collections." (float-time (time-subtract after-init-time before-init-time)) gcs-done)))) ```
3 条评论