Tweak auto update functions

This commit is contained in:
Nathan McCarty 2023-07-08 16:26:21 -04:00
parent 2e0e4ed08f
commit 514983dfe4
Signed by: thatonelutenist
SSH Key Fingerprint: SHA256:hwQEcmak9E6sdU9bXc98RHw/Xd1AhpB5HZT7ZSVJkRM
1 changed files with 12 additions and 7 deletions

View File

@ -494,8 +494,10 @@ Setup org-superstar-mode, to make lists and bullets pretty
(setq org-superstart-special-todo-items t))
#+end_src
Automatically add all files in the org dir to the agenda. This performs some filtering of the files returned from ~directory-files~ to exclude some things that would confuse org-agenda.
We also setup an idle timer, with a short duration, only 30 seconds, to update the ~org-agenda-files~ list, as well as a longer regular timer with a duration of 300 seconds (5 minutes) to keep the agenda up to date even when we are actively using emacs.
Automatically add all files in the org dir to the agenda. This performs some filtering of the files returned from ~directory-files~ to exclude some things that would confuse org-agenda.
We also setup an idle timer, with a short duration, only 30 seconds, to update the ~org-agenda-files~ list, as well as a longer regular timer with a duration of 300 seconds (5 minutes) to keep the agenda up to date even when we are actively using emacs.
We don't set this up on windows, as our emacs usage on windows is limited, and this is quite slow when the backing FS is NTFS
#+begin_src emacs-lisp
(defvar nm/org-agenda-files-timer nil
"Timer for automatically updating the org-agenda files")
@ -539,10 +541,11 @@ Setup org-superstar-mode, to make lists and bullets pretty
(cancel-timer nm/org-agenda-files-timer))
(setq nm/org-agenda-files-timer (run-with-timer 60 nil 'nm/update-org-agenda-files))))
(after! org
(when (not IS-WINDOWS)
(after! org
;; Set the agenda files on first start
;; This also configures the timer for us
(nm/update-org-agenda-files))
(nm/update-org-agenda-files)))
#+end_src
Set up two different timers for updating the org-agenda buffer.
@ -550,7 +553,9 @@ Set up two different timers for updating the org-agenda buffer.
The idle timer simply updates the views unconditionally, and is set with a slightly higher timeout than our idle time that updates the org agenda files. This idle time can safely modify the state of the buffer without any other checks, as if the user is idle, they aren't doing anything in the buffer
+ Timer timer
Setup a timer that attempts to update the org-agenda buffer every 5 minutes. This timer is a little bit unsafe, so it _could_ end up annoying the user by updating the state while they are in the middle of doing something, so it cancels out and does nothing if the user is currently focused on the agenda buffer.
#+begin_src emacs-lisp
This is disabled for now as I don't currently use the functionality and really need a better way to do this
#+begin_src emacs-lisp :tangle no
(defvar nm/org-agenda-update-timer nil
"Timer for automatically updating the org-agenda views")