org-timed-alerts icon indicating copy to clipboard operation
org-timed-alerts copied to clipboard

slows down my agenda, could run hook on idle instead?

Open unhammer opened this issue 3 years ago • 1 comments

I noticed it was severely slowing down my agenda display (75% of time spent says profiler), so I turned (setq org-timed-alerts-agenda-hook-p nil) and used this instead:

(defvar my-org-timed-alerts-set-all-timers-timer nil)
  (defun my-org-timed-alerts-set-all-timers ()
    "Set all timers on idle."
    (when (timerp my-org-timed-alerts-set-all-timers-timer)
      (cancel-timer my-org-timed-alerts-set-all-timers-timer))
    (setq my-org-timed-alerts-set-all-timers-timer
          (run-with-idle-timer 10 nil #'org-timed-alerts-set-all-timers)))
  (add-hook 'org-agenda-mode-hook #'my-org-timed-alerts-set-all-timers)

Would you like a PR or do you prefer to keep the code simple? (Thought I'd share at least in case others find it useful.)

unhammer avatar May 04 '21 08:05 unhammer

I agree the agenda hook isn't ideal and I've found it frustrating when scrolling through days in the agenda view. I like the idle timer idea. Let me mess with this in the next week or two and figure out the best way to handle it.

legalnonsense avatar May 04 '21 15:05 legalnonsense