From 514983dfe4f559634e6487d1f0d50fabce4db9d9 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Sat, 8 Jul 2023 16:26:21 -0400 Subject: [PATCH] Tweak auto update functions --- config.org | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/config.org b/config.org index 1ea1ab6..8c34976 100644 --- a/config.org +++ b/config.org @@ -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 - ;; Set the agenda files on first start - ;; This also configures the timer for us - (nm/update-org-agenda-files)) +(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))) #+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")