Improve startup performance and reduce resource usage
- Defer elfeed auto-update timers until first use (was running at startup) - Fix consult-project-function to handle nil project gracefully - Remove duplicate delete-trailing-whitespace hook - Remove redundant diff-hl find-file-hook (global-diff-hl-mode handles it) - Reduce treemacs resource usage (lower git entries, disable filewatch) - Make dired dotfiles-first sorting opt-in (C-c s to sort, C-c S to toggle) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -51,15 +51,16 @@
|
||||
(lambda ()
|
||||
(message "Feed update complete!"))))
|
||||
|
||||
;; Store timer references so we can cancel them
|
||||
;; Timer references for auto-updates (started lazily on first elfeed use)
|
||||
(defvar elfeed-update-timer-30min nil
|
||||
"Timer for 30-minute elfeed updates.")
|
||||
|
||||
;; Auto-update feeds every 30 minutes in the background
|
||||
;; Delayed start to avoid impacting startup performance
|
||||
(setq elfeed-update-timer-30min
|
||||
(run-with-timer (* 5 60) (* 30 60) #'elfeed-update-async))
|
||||
|
||||
|
||||
(defvar elfeed-update-timer-hourly nil
|
||||
"Timer for hourly elfeed updates.")
|
||||
|
||||
(defvar elfeed-timers-initialized nil
|
||||
"Whether elfeed auto-update timers have been started.")
|
||||
|
||||
;; Custom function for fuzzy relative timestamps
|
||||
(defun my-elfeed-search-format-date (date)
|
||||
"Format DATE as a fuzzy relative time string."
|
||||
@@ -181,6 +182,9 @@
|
||||
|
||||
;; Keybindings for elfeed
|
||||
(with-eval-after-load 'elfeed
|
||||
;; Start auto-update timers when elfeed is first opened (lazy initialization)
|
||||
(add-hook 'elfeed-search-mode-hook #'elfeed-maybe-start-auto-updates)
|
||||
|
||||
;; Disable CUA mode in elfeed buffers to allow single-key commands
|
||||
(add-hook 'elfeed-search-mode-hook
|
||||
(lambda ()
|
||||
@@ -213,14 +217,6 @@
|
||||
(rmh-elfeed-org-process rmh-elfeed-org-files rmh-elfeed-org-tree-id)
|
||||
(message "Elfeed feeds reloaded from org files. %d feeds loaded." (length elfeed-feeds))))
|
||||
|
||||
;; Store timer reference for hourly updates
|
||||
(defvar elfeed-update-timer-hourly nil
|
||||
"Timer for hourly elfeed updates.")
|
||||
|
||||
;; Update feeds every hour
|
||||
(setq elfeed-update-timer-hourly
|
||||
(run-at-time 0 (* 60 60) 'elfeed-update))
|
||||
|
||||
;; Functions to control auto-updates
|
||||
(defun elfeed-stop-auto-updates ()
|
||||
"Stop all automatic elfeed feed updates."
|
||||
@@ -231,6 +227,7 @@
|
||||
(when (timerp elfeed-update-timer-hourly)
|
||||
(cancel-timer elfeed-update-timer-hourly)
|
||||
(setq elfeed-update-timer-hourly nil))
|
||||
(setq elfeed-timers-initialized nil)
|
||||
(message "Elfeed auto-updates stopped."))
|
||||
|
||||
(defun elfeed-start-auto-updates ()
|
||||
@@ -240,9 +237,16 @@
|
||||
(setq elfeed-update-timer-30min
|
||||
(run-with-timer (* 5 60) (* 30 60) #'elfeed-update-async))
|
||||
(setq elfeed-update-timer-hourly
|
||||
(run-at-time 0 (* 60 60) 'elfeed-update))
|
||||
(run-at-time (* 5 60) (* 60 60) 'elfeed-update))
|
||||
(setq elfeed-timers-initialized t)
|
||||
(message "Elfeed auto-updates started."))
|
||||
|
||||
(defun elfeed-maybe-start-auto-updates ()
|
||||
"Start auto-updates if not already initialized.
|
||||
This is called when elfeed is first opened."
|
||||
(unless elfeed-timers-initialized
|
||||
(elfeed-start-auto-updates)))
|
||||
|
||||
;; Sorting functions
|
||||
(defun elfeed-sort-by-date-ascending ()
|
||||
"Sort elfeed entries by date ascending (oldest first)."
|
||||
|
||||
Reference in New Issue
Block a user