9.2 Inserting Letter to Which You’re Replying

It is often useful to insert a snippet of text from a letter that someone mailed to provide some context for your reply. The command C-c C-y (mh-yank-cur-msg) does this by adding an attribution, yanking a portion of text from the message to which you’re replying, and inserting mh-ins-buf-prefix (‘> ’) before each line.

Michael W Thelen <thelenm@stop.mail-abuse.org> wrote:

> Hopefully this gives you an idea of what I'm currently doing. I'm not
> sure yet whether I'm completely satisfied with my setup, but it's
> worked okay for me so far.

The attribution consists of the sender’s name and email address followed by the content of the option mh-extract-from-attribution-verb. This option can be set to ‘wrote:’, ‘a √©crit:’, and ‘schrieb:’. You can also use the ‘Custom String’ menu item to enter your own verb.

The prefix "> " is the default setting for the option mh-ins-buf-prefix. I suggest that you not modify this option since it is used by many mailers and news readers: messages are far easier to read if several included messages have all been indented by the same string. This prefix is not inserted if you use one of the supercite flavors of mh-yank-behavior or you have added a mail-citation-hook as described below.

You can also turn on the mh-delete-yanked-msg-window-flag option to delete the window containing the original message after yanking it to make more room on your screen for your reply.

You can control how the message to which you are replying is yanked into your reply using mh-yank-behavior. To include the entire message, including the entire header, use ‘Body and Header3536. Use ‘Body’ to yank just the body without the header. To yank only the portion of the message following the point, set this option to ‘Below Point’.

Choose ‘Invoke supercite37 to pass the entire message and header through supercite.

If the ‘Body With Attribution’ setting is used, then the message minus the header is yanked and a simple attribution line is added at the top using the value of the option mh-extract-from-attribution-verb. This is the default.

If the ‘Invoke supercite’ or ‘Body With Attribution’ settings are used, the ‘-noformat’ argument is passed to the repl program to override a ‘-filter’ or ‘-format’ argument. These settings also have ‘Automatically’ variants that perform the action automatically when you reply so that you don’t need to use C-c C-y at all. Note that this automatic action is only performed if the show buffer matches the message being replied to. People who use the automatic variants tend to turn on the option mh-delete-yanked-msg-window-flag as well so that the show window is never displayed.

If the show buffer has a region, the option mh-yank-behavior is ignored unless its value is one of ‘Attribution’ variants in which case the attribution is added to the yanked region.

If this isn’t enough, you can gain full control over the appearance of the included text by setting mail-citation-hook to a function that modifies it. This hook is ignored if the option mh-yank-behavior is set to one of the supercite flavors. Otherwise, this option controls how much of the message is passed to the hook. The function can find the citation between point and mark and it should leave point and mark around the modified citation text for the next hook function. The standard prefix mh-ins-buf-prefix is not added if this hook is set.

For example, if you use the hook function trivial-cite (which is NOT part of Emacs), set mh-yank-behavior to ‘Body and Header’.



If you’d rather have the header cleaned up, use C-u r instead of r when replying (see Replying to Mail).


In the past you would use this setting and set mail-citation-hook to ‘supercite’, but this usage is now deprecated in favor of the ‘Invoke supercite’ setting.


Supercite is a full-bodied, full-featured, citation package that comes standard with Emacs.