Closed guibor closed 3 years ago
I like this idea but this is likely not going to be used by a lot of users so I would like to avoid creating a dedicated customization variable which is going to make the code cumbersome and for which I would have to make decisions like do we want a list of hooks and the first which returns something wins or do we want to override systematically with this function ...
However, in order to make it possible, I made org-msg-post-setup
call a new function named org-msg-get-alternatives
which is in charge of returning the list of alternatives. Now, to implement this behavior all you have to do is to advise the org-msg-get-alternatives
in the way you like.
What do you think?
@guibor, I pushed to master. Could you give it a shot ?
Just used this as follows - suppose this is what you had in mind:
(setq mu4e-plain-reply-regexp "Reply.*docs\\.google\\.com\\|.*email\\.figma\\.com")
(defun org-msg-should-force-plaintext ()
(let ((to-value (message-field-value "To")))
(and (not (s-blank? to-value)) (s-matches? mu4e-plain-reply-regexp to-value))))
(defun org-msg-force-plaintext (alternative)
(if (org-msg-should-force-plaintext)
'(text)
alternative))
(advice-add 'org-msg-get-alternatives :filter-return #'org-msg-force-plaintext)
And it works very nicely! I have another suggestion in the same vein regarding signature and style (I'll open a separate FR on that).
Another opportunity to thank you for this amazing package (that several other people at my workplace use as well and love).
Just used this as follows - suppose this is what you had in mind:
Indeed, that's the sort of customization I had in mind. I have extended this "logic" to a level which should support your #104 FR.
Another opportunity to thank you for this amazing package (that several other people at my workplace use as well and love).
Thank you. That's always a great pleasure to get positive feedback on one of my little projects.
Closing this ticket now.
e.g when replying to certain addresses or certain types of email, dynamically set the alernative. Currently I implement this behavior using a
message-send-hook
that determines the value oforg-msg-default-alternatives
which is hacky.