From 0c2b5aaffcdf612be0a9a6ae4942f526a5226c39 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Thu, 2 Apr 2020 18:14:59 -0400 Subject: [PATCH] Save gcal org buffers after fetch --- emacs/init.org | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/emacs/init.org b/emacs/init.org index 962bc98..fca0881 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -1859,12 +1859,22 @@ Integrate Google calendar with org-mode: ("lut2o2moohg6qkdsto1qfq7th4@group.calendar.google.com" . ,(get-calendar-file "j-n-gcal.org"))) org-gcal-notify-p nil)) - (add-hook 'emacs-startup-hook #'org-gcal-fetch) + (defun org-gcal-fetch-and-save () + (interactive) + (deferred:$ + (org-gcal-fetch) + (deferred:nextc it + (lambda () + (dolist (entry org-gcal-file-alist) + (with-current-buffer (cdr entry) + (save-buffer))))))) + + (add-hook 'emacs-startup-hook #'org-gcal-fetch-and-save) (defun org-agenda-redo-and-fetch-gcal (&optional all) (interactive "P") (let ((cb (if all #'org-agenda-redo-all #'org-agenda-redo))) - (deferred:nextc (org-gcal-fetch) cb))) + (deferred:nextc (org-gcal-fetch-and-save) cb))) (with-eval-after-load 'org-agenda (general-def '(normal motion) org-agenda-mode-map "gR" #'org-agenda-redo-and-fetch-gcal))