Fix org-gcal save-after-fetch
This commit is contained in:
parent
608cf1a651
commit
90704aa611
@ -1919,37 +1919,34 @@ Integrate Google calendar with org-mode:
|
||||
(defun get-calendar-file (name)
|
||||
(org-directory name))
|
||||
|
||||
(defun org-gcal-sync-advice (oldfn &rest args)
|
||||
(deferred:nextc (apply oldfn args)
|
||||
(lambda (_)
|
||||
(dolist (entry org-gcal-fetch-file-alist)
|
||||
(let ((file (cdr entry)))
|
||||
(with-current-buffer (find-file-noselect file)
|
||||
(save-buffer)))))))
|
||||
|
||||
(use-package org-gcal
|
||||
:after (org)
|
||||
:hook ((emacs-startup . org-gcal-fetch))
|
||||
:commands (org-gcal-sync
|
||||
org-gcal-fetch
|
||||
org-gcal-post-at-point
|
||||
org-gcal-delete-at-point
|
||||
org-gcal-refresh-token)
|
||||
org-gcal-request-token)
|
||||
:config
|
||||
(advice-add 'org-gcal-sync :around #'org-gcal-sync-advice)
|
||||
(setq org-gcal-client-id (password-store-get "lola-org-gcal-client-id")
|
||||
org-gcal-client-secret (password-store-get "lola-org-gcal-client-secret")
|
||||
org-gcal-file-alist `(("jeremydormitzer@lola.com" . ,(get-calendar-file "lola-gcal.org"))
|
||||
("jeremy.dormitzer@gmail.com" . ,(get-calendar-file "personal-gcal.org"))
|
||||
("lut2o2moohg6qkdsto1qfq7th4@group.calendar.google.com" . ,(get-calendar-file "j-n-gcal.org")))
|
||||
org-gcal-fetch-file-alist `(("jeremydormitzer@lola.com" . ,(get-calendar-file "lola-gcal.org"))
|
||||
("jeremy.dormitzer@gmail.com" . ,(get-calendar-file "personal-gcal.org"))
|
||||
("lut2o2moohg6qkdsto1qfq7th4@group.calendar.google.com" . ,(get-calendar-file "j-n-gcal.org")))
|
||||
org-gcal-notify-p nil))
|
||||
|
||||
(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-and-save) cb)))
|
||||
(deferred:nextc (org-gcal-fetch) cb)))
|
||||
|
||||
(with-eval-after-load 'org-agenda
|
||||
(general-def '(normal motion) org-agenda-mode-map "gR" #'org-agenda-redo-and-fetch-gcal))
|
||||
|
Loading…
Reference in New Issue
Block a user