mu4e-icalendar: use message-reply to generate the reply

using mu4e--compose-setup is a little too fragile.
This commit is contained in:
Dirk-Jan C. Binnema 2024-04-12 18:20:41 +03:00
parent 21ab73e0d0
commit adb560d960
1 changed files with 13 additions and 15 deletions

View File

@ -135,21 +135,19 @@
(plist-get (car (plist-get msg :reply-to)) :email) (plist-get (car (plist-get msg :reply-to)) :email)
(plist-get (car (plist-get msg :from)) :email) (plist-get (car (plist-get msg :from)) :email)
(mu4e-warn "Cannot find organizer")))) (mu4e-warn "Cannot find organizer"))))
(mu4e--compose-setup (message-reply organizer)
'reply (goto-char (point-max))
(lambda (_parent) (message-goto-body)
(message-reply organizer) (mml-insert-multipart "alternative")
(goto-char (point-max)) (mml-insert-empty-tag 'part 'type "text/plain")
(message-goto-body) (mml-attach-buffer ical-name
(mml-insert-multipart "alternative") "text/calendar; method=REPLY; charset=UTF-8")
(mml-insert-empty-tag 'part 'type "text/plain") (mu4e-compose-mode)
(mml-attach-buffer ical-name (when mu4e-icalendar-trash-after-reply
"text/calendar; method=REPLY; charset=UTF-8") ;; Override `mu4e-sent-handler' set by `mu4e-compose-mode' to
(when mu4e-icalendar-trash-after-reply ;; also trash the message (thus must be appended to hooks).
;; Override `mu4e-sent-handler' set by `mu4e-compose-mode' to (add-hook 'message-sent-hook
;; also trash the message (thus must be appended to hooks). (mu4e--icalendar-trash-message-hook msg) 90 t))
(add-hook 'message-sent-hook
(mu4e--icalendar-trash-message-hook msg) 90 t))))
(when gnus-icalendar-org-enabled-p (when gnus-icalendar-org-enabled-p
(if (gnus-icalendar-find-org-event-file event) (if (gnus-icalendar-find-org-event-file event)