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?


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.

  • Try wrapping the line in : characters, IIRC this should make it into an inline example.
    – user12563
    Commented Jun 1, 2018 at 11:21
  • Thanks for reply. When I try this it doesn't work; lines that only contain ">" become ":>:" and other lines look the same - the ":" disappears, but the post fix ":" is rendered. Also, it might be tricky to post fix the ":" - in my test I did it manually, but the message-yank funcitons, I think, only cater for a prefix.
    – Phil
    Commented Jun 1, 2018 at 11:39

1 Answer 1


It looks to me like it's impossible to mark on a line-by-line basis, allowing you to leverage the already existing message-yank-prefix settings.

So I went back and reread the mu4e and message source code to see what else I could piggy-back off.

I have a solution below providing you don't need separate formatting for example blocks - for example using org-mime-change-element-style or org-mime-change-class style.

Providing you control formatting at the class level, you can differentiate between src and example blocks, which is fine for me.

It is an improvement of the more hacky suggestion in the question of using message-citation-line-format and mu4e-compose-signature to wrap the original message in a way that prevents it's contents being interpreted as mark-up, but also making sure that org-mime-htmlize doesn't discard it completely from the message.

This is still a bit crude, but it seems to work!

(defun message-cite-original-without-signature-wrapped-example ()
  (message-cite-original-1 t)
  (goto-char (point))
  (insert "#+BEGIN_EXAMPLE\n")
  (goto-char (mark t))
  (insert "#+END_EXAMPLE"))

(setq mu4e-compose-cite-function 'message-cite-original-without-signature-wrapped-example)

I won't mark it as accepted just yet - it's possible that a cleaner solution exists!


Having played around with it some more, it does appear the mu4e makes an attempt to properly indent ">". However there are still problems with indented text if it contains characters that org confuses are mark-up.

For example if you respond to an e-mail containing some random shell command liek the following:

./foo_bar.sh -i ./input/AB_foo_bar_volume_1.csv -t ./foo /bar_AB_foo.xslt -p foo.test.xml -b foo

It will screw-up completely in the quoted e-mail.

It will display correctly with the proposed fix.

  • (goto-char (point)) is a nop, as point returns current point in buffer.
    – user12563
    Commented Jun 1, 2018 at 16:15
  • Thanks - I thought that might be the case - I will verify and update the answer.
    – Phil
    Commented Jun 1, 2018 at 23:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.