Making caldav sync asynchronous

This commit is contained in:
Misha 2025-04-07 14:45:54 +02:00
parent 9a51cf4a2c
commit dc22f7d4aa
3 changed files with 14 additions and 3 deletions

View file

@ -309,6 +309,7 @@
epkgs.google-translate
epkgs.markdown-mode
epkgs.nix-mode
epkgs.async
]))
];

View file

@ -1672,7 +1672,7 @@ For example for when you're running code and immediately want to check the outpu
(spc-define-keys spc-leader-map
"occ" 'my-org-capture
"oc1" 'org-capture
"mau" 'caldav-save-and-sync
"mau" 'mv/caldav-async
"maq" 'open-cal-mv-quick
"mad" 'open-cal-mv-thorough
)
@ -1771,6 +1771,7 @@ For example for when you're running code and immediately want to check the outpu
(defun open-cal-mv-quick ()
(interactive)
;;(refresh-theme)
;;(mv/caldav-async)
(if in-colombia (progn
(setq org-agenda-files
(mapcar (lambda (var)
@ -2062,6 +2063,15 @@ For example for when you're running code and immediately want to check the outpu
(org-caldav-sync)
(advice-remove 'yes-or-no-p (lambda (_prompt) t))))
(defun mv/caldav-async ()
(interactive)
(make-thread
(lambda ()
(caldav-save-and-sync))))
;; Run at startup
(mv/caldav-async)
(setq org-caldav-sync-changes-to-org 'all)
(require 'auth-source)
(setq auth-sources

View file

@ -1055,8 +1055,8 @@ Should I try to resume? "))))
(dolist (calendar org-caldav-calendars)
(org-caldav-debug-print 1 "Syncing first calendar entry:" calendar)
(org-caldav-sync-calendar calendar))))
(when org-caldav-show-sync-results
(org-caldav-display-sync-results))
;; (when org-caldav-show-sync-results
;; (org-caldav-display-sync-results))
(message "Finished sync."))
(defun org-caldav-update-events-in-cal (icsbuf)