Add org-caldav – sync caldav calendar with org file.
This commit is contained in:
parent
b60f4e6f51
commit
77f3b51e09
|
@ -112,7 +112,9 @@
|
|||
:custom ((org-default-notes-file "~/notes.org")
|
||||
(org-startup-folded nil)
|
||||
(org-latex-compiler "xelatex")
|
||||
(org-agenda-files '("~/notes.org" "~/Dokumente/Videoserien.org"))
|
||||
(org-agenda-files '("~/notes.org"
|
||||
"~/Dokumente/Videoserien.org"
|
||||
"~/.calendars/org/tastytea_calendar.org"))
|
||||
(org-blank-before-new-entry
|
||||
'((heading . nil) (plain-list-item . auto)))
|
||||
(org-agenda-show-all-dates nil)
|
||||
|
@ -215,5 +217,48 @@
|
|||
|
||||
(use-package json-mode)
|
||||
|
||||
;; Sync with CalDAV
|
||||
(use-package org-caldav
|
||||
:defer t
|
||||
:custom ((org-caldav-url "https://buzuk.tastytea.de/caldav.php/tastytea")
|
||||
(org-caldav-calendar-id "calendar")
|
||||
(org-caldav-inbox "~/.calendars/org/tastytea_calendar.org")
|
||||
(org-icalendar-timezone "Europe/Berlin")
|
||||
(org-caldav-files nil))
|
||||
;; <https://github.com/dengste/org-caldav/issues/231>
|
||||
:config (defun org-caldav-url-dav-get-properties (url property)
|
||||
"Retrieve PROPERTY from URL.
|
||||
Output is the same as `url-dav-get-properties'. This switches to
|
||||
OAuth2 if necessary."
|
||||
(let ((request-data (concat "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" "<propfind xmlns='DAV:'>\n<prop>" "<" property "/></prop></propfind>\n"))
|
||||
(extra '(("Depth" . "1") ("Content-type" . "text/xml"))))
|
||||
(let ((resultbuf (org-caldav-url-retrieve-synchronously
|
||||
url "PROPFIND" request-data extra)))
|
||||
(with-current-buffer resultbuf
|
||||
(goto-char (point-min))
|
||||
(when (not (re-search-forward "^HTTP[^ ]* \\([0-9]+ .*\\)$"
|
||||
(point-at-eol) t))
|
||||
(switch-to-buffer buffer)
|
||||
(error "No valid HTTP response from URL %s." url))
|
||||
(let ((response (match-string 1)))
|
||||
(when (not (string-match "2[0-9][0-9].*" response))
|
||||
(switch-to-buffer resultbuf)
|
||||
(error "Error while doing PROPFIND for '%s' at URL %s: %s" property url response))))
|
||||
(org-caldav-namespace-bug-workaround resultbuf)
|
||||
;; HACK: remove DAV:responses with empty properties
|
||||
(with-current-buffer resultbuf
|
||||
(save-excursion
|
||||
(while (re-search-forward "<response>" nil t)
|
||||
(let ((begin (point))
|
||||
(end (progn (re-search-forward "<response>" nil t) (+ (point) 0))))
|
||||
(when (and begin end)
|
||||
(goto-char begin)
|
||||
(if (and (re-search-forward "<prop/>" nil t) (< (point) end))
|
||||
(progn
|
||||
(goto-char end)
|
||||
(delete-region begin end))
|
||||
(goto-char end)))))))
|
||||
(url-dav-process-response resultbuf url)))))
|
||||
|
||||
(provide 'text/misc)
|
||||
;;; misc.el ends here
|
||||
|
|
Loading…
Reference in New Issue
Block a user