dengste / org-caldav

Caldav sync for Emacs orgmode
GNU General Public License v3.0
712 stars 105 forks source link

`icalendar--read-element` needs an unfolded buffer as returned from `icalendar--get-unfolded-buffer` #253

Open m-h-b-tu opened 1 year ago

m-h-b-tu commented 1 year ago

The function org-caldav-convert-event calls icalendar--read-element but that needs an unfolded buffer according to its doc-string which would otherwise result in wrong parsing splitted lines. I currently use org-caldav with the following advice which calls icalendar--get-unfolded-buffer first.

(defun org-caldav-unfold-before-convert-event (old-func)
    (with-current-buffer (icalendar--get-unfolded-buffer (current-buffer))
      (funcall old-func)))

  (advice-add #'org-caldav-convert-event :around #'org-caldav-unfold-before-convert-event)
jackkamm commented 1 year ago

I believe that the lines starting here are supposed to do the unfolding:

https://github.com/dengste/org-caldav/blob/8569941a0a5a9393ba51afc8923fd7b77b73fa7a/org-caldav.el#L585

And for me, on Linux & radicale, it seems to work fine for unfolding the icalendar buffer.

But maybe this is less robust than using icalendar--get-unfolded-buffer. What OS & caldav server are you using? And could you provide an example ics that org-caldav doesn't unfold correctly?