diff options
author | Austin Clements <amdragon@MIT.EDU> | 2014-02-20 14:16:34 -0500 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2014-02-22 19:50:55 -0400 |
commit | 1326ec09ee369b152a6c9bed5fe42c2d80180d01 (patch) | |
tree | b19675a26a702c903d9c847d659cf8fd8b0205b9 /emacs/notmuch-lib.el | |
parent | 01b82dc780670a7e3d314c56b4699fcf9d70046a (diff) |
emacs: Build forwarded message buffer more directly
Previously, we used `message-forward' to build forwarded messages, but
this function is simply too high-level to be a good fit for some of
what we do.
First, since `message-forward' builds a full forward message buffer
given the message to forward, we have to duplicate much of the logic
in `notmuch-mua-mail' to patch the notmuch-y things into the built
buffer.
Second, `message-forward' constructs the From header from
user-full-name and user-mail-address. As a result, if we prompt the
user for an identity, we have to parse it into name and address
components, just to have it put back together by `message-forward'.
This process is not entirely loss-less because
`mail-extract-address-components' does a lot of canonicalization
(since it's intended for displaying addresses, not for parsing them).
To fix these problems, don't use `message-forward' at all.
`message-forward' itself is basically just a call to `message-mail'
and `message-forward-make-body'. Do this ourselves, but call
`notmuch-mua-mail' instead of `message-mail' so we can directly build
a notmuch-y message and control the From header.
This also fixes a bug that was a direct consequence of our use of
`mail-extract-address-components': if the user chose an identity that
had no name part (or the name part matched the mailbox), we would bind
user-full-name to nil, which would cause an exception in the bowels of
message-mode because user-full-name is expected to always be a string
(even if it's just "").
Diffstat (limited to 'emacs/notmuch-lib.el')
0 files changed, 0 insertions, 0 deletions