Skip to content

Commit

Permalink
Move CRLF conversion for future-proofing
Browse files Browse the repository at this point in the history
ox-icalendar export of CRLF line endings may change in future to be
more consistent and better agree with RFC 5545 [1], but this may cause
surprising breakage, because emacs will then open the ICS file in DOS
coding, removing the ^M endings from the buffer string. This commit
moves `org-caldav-convert-buffer-to-crlf' earlier to guarantee the
^M is present and avoid possible breakage.

[1] See discussion about CRLF starting at https://list.orgmode.org/87o7oetneo.fsf@localhost/T/#m3e3eb80f9fc51ba75854b33ebfe9ecdefa2ded24
  • Loading branch information
jackkamm committed Mar 31, 2023
1 parent cc1b820 commit 618bf4c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion org-caldav.el
Expand Up @@ -1087,14 +1087,14 @@ ICSBUF is the buffer containing the exported iCalendar file."
(unless (string-match (car cur) uid)
(error "Could not find UID %s" (car cur)))
(org-caldav-narrow-event-under-point)
(org-caldav-convert-buffer-to-crlf)
(org-caldav-cleanup-ics-description)
(org-caldav-maybe-fix-timezone)
(org-caldav-set-sequence-number cur event-etag)
(org-caldav-fix-todo-priority)
(org-caldav-fix-todo-status-percent-state)
(org-caldav-fix-categories)
(org-caldav-fix-todo-dtstart)
(org-caldav-convert-buffer-to-crlf)
(message "Putting event %d of %d Org --> Cal" counter (length events))
(if (org-caldav-put-event icsbuf)
(org-caldav-event-set-etag cur 'put)
Expand Down Expand Up @@ -1210,6 +1210,7 @@ This is a bug in older Org versions."
(when (search-forward "BEGIN:VTODO" nil t)
(search-forward "PRIORITY:")
(unless (eq (thing-at-point 'number) 0)
;; NOTE: Deletion up to eol-1 assumes the line ends with ^M
(delete-region (point) (- (point-at-eol) 1))
(insert (number-to-string
(save-excursion
Expand Down

0 comments on commit 618bf4c

Please sign in to comment.