mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 04:18:08 +01:00
notmuch-show.el: import calendar data with public function after CR removal
notmuch-get-bodypart-content provides raw data to its caller so that it can be stored verbatim whenever needed. icalendar functions expect Emacs to do EOL conversion for the data given to these. Therefore it the CRLF -> LF conversion is now done explicitly. The calls to private functions icalendar--convert-ical-to-diary and icalendar--read-element are replaced with call to public function icalendar-import-buffer.
This commit is contained in:
parent
3bd8494da0
commit
60b5bff53d
1 changed files with 5 additions and 3 deletions
|
@ -747,12 +747,14 @@ message at DEPTH in the current thread."
|
||||||
(notmuch-show-insert-part-header nth declared-type content-type (plist-get part :filename))
|
(notmuch-show-insert-part-header nth declared-type content-type (plist-get part :filename))
|
||||||
(insert (with-temp-buffer
|
(insert (with-temp-buffer
|
||||||
(insert (notmuch-get-bodypart-content msg part nth notmuch-show-process-crypto))
|
(insert (notmuch-get-bodypart-content msg part nth notmuch-show-process-crypto))
|
||||||
|
;; notmuch-get-bodypart-content provides "raw", non-converted
|
||||||
|
;; data. Replace CRLF with LF before icalendar can use it.
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
|
(while (re-search-forward "\r\n" nil t)
|
||||||
|
(replace-match "\n" nil nil))
|
||||||
(let ((file (make-temp-file "notmuch-ical"))
|
(let ((file (make-temp-file "notmuch-ical"))
|
||||||
result)
|
result)
|
||||||
(icalendar--convert-ical-to-diary
|
(icalendar-import-buffer file t)
|
||||||
(icalendar--read-element nil nil)
|
|
||||||
file t)
|
|
||||||
(set-buffer (get-file-buffer file))
|
(set-buffer (get-file-buffer file))
|
||||||
(setq result (buffer-substring (point-min) (point-max)))
|
(setq result (buffer-substring (point-min) (point-max)))
|
||||||
(set-buffer-modified-p nil)
|
(set-buffer-modified-p nil)
|
||||||
|
|
Loading…
Reference in a new issue