org-msg
org-msg copied to clipboard
How to temporarily disable Org-Msg for other functions (e.g. gnus-icalendar)
As an example of where Org-Msg being enabled causes a problem, there is some built-in functionality of Gnus which can handle calendar appointments by constructing the appointment responses and sending them on behalf of the user (see function gnus-icalendar-send-buffer-by-mail
and note how the regular mail signature is suppressed). I believe the appointment handling in mu4e also just wraps the Gnus code.
I imagine it would be possible to add advice to these functions to check that Org-Msg is enabled, disable it, and then re-enable it again afterwards, but is that the only/best way to do it? Or possibly this particular feature and issue is within scope for Org-Msg to set the advice directly?
I'm using this for the moment:
(defun mw/call-without-org-msg-mode (orig-fun &rest args)
(let ((was-active org-msg-mode))
(when was-active
(org-msg-mode -1))
(prog1
(apply orig-fun args)
(when was-active
(org-msg-mode 1)))))
(require 'gnus-icalendar)
(advice-add 'gnus-icalendar-send-buffer-by-mail
:around #'mw/call-without-org-msg-mode)
Since this is solving a problem which potentially exists for all of the mail user agents (Gnus and mu4e are affected for sure) perhaps it would be acceptable to include the workaround in the package itself, or at least document it. Possibly there is a better way to temporarily toggle a mode but I couldn't find one when searching.
Thanks for the suggestion, I have integrated it.
Thanks!
I'm not sure whether to leave this issue open with the question of how to temporarily disable Org-Msg in more general cases or whether that is out of scope. I'll leave it to your judgement, either way is fine by me.
This doesn't work for me, but #149 does work
BTW, I wonder if there are other mail clients also have icalendar integration and needed same fixes for them.