I'm using org-mime to send e-mails inside mu4e - the exact details are outlined in the reference here. I will cover the specifics of this problem below.
This works well, however when replying I note that the reply is also passed to org-mime-htmlize
and as such it is treated as org mark-up.
Here's my reply message
Foo Bar writes:
> Here is an example of what it looks like in the edit buffer before I send the message
> He's another line
> And another
__
Here's my signature
This causes incorrect formatting when characters in the original message coincidentally represent org mark-up.
The most obvious problem is that each original line is by default prefixed with a ">", and org is interpretting every other line as what looks like a column divider in a table.
This is configurable using message-yank-empty-prefix
, message-yank-cited-prefix
, and message-yank-prefix
.
What I need is a string-prefix to each line such that org will interpret it as "treat the whole of this line as plain text". This would nicely fix the specific example above, but also any other mark-up issues on the lines.
The documentation doesn't really suggest a method for doing this (there is a footnote that suggests using a comma as the first character, but this doesn't seem to work, and the comma is rendered in the HTML reply too).
There are other possible options but they are more complex and clunky - I'll share these below:
For example I have considered customizing message-citation-line-format
and mu4e-compose-signature
to effectively wrap the text in between in a #+BEGIN_EXAMPLE
and #+END_EXAMPLE
block. That works, kinda, but obviously the #+END_EXAMPLE
also exists when Composing a completely new message.
It may also be possible to escape all the characters in the original message before passing it org-mime-htmlize
- I haven't been able to work out a way of doing this tho.
Lastly I'm wondering if I can mark the region somehow before calling org-mime-htmlize
- my problem here is that both my response and signature are in org mark-up, so I'd need to mark both regions. It's not clear to me what happens to the text that isn't marked, is it discarded or included as plain text?
I'm hoping this problem has come-up before - does anyone have any pointers on how make sure original messages are properly rendered in replies?
Update
A clue from stackoverflow gave me the right teminology to use!
From the manual here I note that the correct terminology is emphasis in org-mode.
So I should be surrounding lines in "=" for verbatim or "~" for code.
Strange thing is I do this then the whole line disappears from the resulting e-mail!
This doesn't happen if I use #+BEGIN_EXAMPLE
. or #+BEGIN_SRC
.
I'm assuming org-mime is simply discounting any plain text in the message?
I can also confirm that if you highlight a region within an e-mail, anything outside that region is completed discounted by org-mime-htmlize
- that is, not only is it not processed as org mark-up, it is completely excluded from the final message. So this method isn't going to work.
:
characters, IIRC this should make it into an inline example.message-yank
funcitons, I think, only cater for a prefix.