On Thu, 19 Jan 2012 10:46:57 -0700, Adam Wolfe Gordon <awg+notmuch@xvx.ca> wrote: > Instead of using a static citation line for the first line of the > reply message, use the customizable one defined by message-mode. > This makes it easy for users to customize the reply style, and > retains consistency for users with existing message-mode > customizations. > --- > emacs/notmuch-mua.el | 19 ++++++++++++++++--- > test/emacs | 2 +- > 2 files changed, 17 insertions(+), 4 deletions(-) > > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el > index 5ae0ccf..e485d93 100644 > --- a/emacs/notmuch-mua.el > +++ b/emacs/notmuch-mua.el > @@ -134,9 +134,22 @@ list." > (forward-line -1) > (goto-char (point-max))) > > - (insert (format "On %s, %s wrote:\n" > - (cdr (assq 'date original-headers)) > - (cdr (assq 'from original-headers)))) > + (let* ((quoth message-citation-line-format) > + (case-fold-search nil) > + (full-from (cdr (assq 'from original-headers))) > + (from-addr (car (mail-header-parse-address full-from))) > + (from-name (cdr (mail-header-parse-address full-from))) > + (first-name (car (split-string from-name))) > + (last-name (append (cdr (split-string from-name)))) > + (time (date-to-time (cdr (assq 'date original-headers))))) > + > + (setq quoth (replace-regexp-in-string "%f" full-from quoth t t)) > + (setq quoth (replace-regexp-in-string "%n" from-addr quoth t t)) > + (setq quoth (replace-regexp-in-string "%N" from-name quoth t t)) > + (setq quoth (replace-regexp-in-string "%F" first-name quoth t t)) > + (setq quoth (replace-regexp-in-string "%L" last-name quoth t t)) > + (setq quoth (format-time-string quoth time)) > + (insert quoth)) Shouldn’t this just use message-insert-formatted-citation-line? Another approach you might take with this patch series is to look at the message-cite-original function (which I just discovered as I was plumbing around in message.el looking for the function to format the citation line). I think that what one does to use this fn is to put the original message text into the reply buffer (unquoted), set point and mark to encompass it, then call the fn. It automatically handles inserting the quotes, and has some customization options (stripping signatures from replies, customizable quote character instead of “>”, ...). The message-cite-original function also adds escape characters to the cookies that message-mode uses to indicate sign/encrypt/attach directives. I think notmuch exposes files on the user’s computer to others, if a user can be tricked into replying to a message with an attachment cookie and not stripping the cookie from the reply text. So to mitigate this, whatever reply mechanism winds up being used should call mml-quote-region on the reply text (as message-cite-original does). I just sent a patch to the list to do this in the current version of notmuch, which should show up in id:"1326998589-37187-1-git-send-email-aaronecay@gmail.com" . -- Aaron Ecay