org-msg icon indicating copy to clipboard operation
org-msg copied to clipboard

How to temporarily disable Org-Msg for other functions (e.g. gnus-icalendar)

Open morganwillcock opened this issue 2 years ago • 5 comments

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?

morganwillcock avatar Sep 18 '21 22:09 morganwillcock

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.

morganwillcock avatar Feb 21 '22 20:02 morganwillcock

Thanks for the suggestion, I have integrated it.

jeremy-compostella avatar Mar 31 '22 17:03 jeremy-compostella

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.

morganwillcock avatar Mar 31 '22 19:03 morganwillcock

This doesn't work for me, but #149 does work

johnhamelink avatar Apr 14 '22 15:04 johnhamelink

BTW, I wonder if there are other mail clients also have icalendar integration and needed same fixes for them.

jumper047 avatar Apr 14 '22 16:04 jumper047