no more auto sync just on close )

This commit is contained in:
2025-04-14 19:30:09 +02:00
parent 0db067028e
commit b7ea7d8917
2 changed files with 552 additions and 13 deletions

View File

@@ -156,9 +156,9 @@
:init
;; This is the sync on close function; it also prompts for save after syncing so
;; no late changes get lost
;; (defun org-caldav-sync-at-close ()
;; (org-caldav-sync)
;; (save-some-buffers))
(defun org-caldav-sync-at-close ()
(org-caldav-sync)
(save-some-buffers))
;;
;; This is the delayed sync function; it waits until emacs has been idle for
;; "secs" seconds before syncing. The delay is important because the caldav-sync
@@ -166,14 +166,15 @@
;; This way it just waits until you've been idle for a while to avoid disturbing
;; the user.
(setq-default org-caldav-inbox nil)
(defvar org-caldav-sync-timer nil
"Timer that `org-caldav-push-timer' used to reschedule itself, or nil.")
(defun org-caldav-sync-with-delay (secs)
(when org-caldav-sync-timer
(cancel-timer org-caldav-sync-timer))
(setq org-caldav-sync-timer
(run-with-idle-timer
(* 1 secs) nil 'org-caldav-sync)))
(setq org-caldav-calendar-id "work")
;; (defvar org-caldav-sync-timer nil
;; "Timer that `org-caldav-push-timer' used to reschedule itself, or nil.")
;; (defun org-caldav-sync-with-delay (secs)
;; (when org-caldav-sync-timer
;; (cancel-timer org-caldav-sync-timer))
;; (setq org-caldav-sync-timer
;; (run-with-idle-timer
;; (* 1 secs) nil 'org-caldav-sync)))
(setq org-caldav-files '("~/org/.archive/appointments.org"))
;; Actual calendar configuration edit this to meet your specific needs
@@ -203,7 +204,6 @@
(setq org-icalendar-categories '(local-tags))
:config
(setq org-caldav-calendar-id "work")
(setq org-icalendar-alarm-time 1)
(setq org-caldav-sync-direction 'org->cal)
;; This makes sure to-do items as a category can show up on the calendar
@@ -221,7 +221,7 @@
(when (eq major-mode 'org-mode)
(org-caldav-sync-with-delay 300))))
;; Add the close emacs hook
;;(add-hook 'kill-emacs-hook 'org-caldav-sync-at-close)
(add-hook 'kill-emacs-hook 'org-caldav-sync-at-close)
(add-to-list 'org-caldav-todo-percent-states
'( 0 "IDEA")
)