Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 78961431FAF for ; Thu, 19 Jan 2012 10:45:16 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.699 X-Spam-Level: X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a0bS7wgOPDAU for ; Thu, 19 Jan 2012 10:45:15 -0800 (PST) Received: from mail-qw0-f46.google.com (mail-qw0-f46.google.com [209.85.216.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id CA158431FAE for ; Thu, 19 Jan 2012 10:45:15 -0800 (PST) Received: by qadc10 with SMTP id c10so2768912qad.5 for ; Thu, 19 Jan 2012 10:45:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; bh=A9ddyFh3vqOB6PEKqLfL0cvLomX7aZAZTZLtFbwuflU=; b=WAwq/wMdd8FsXEKjtuUQ1ZhewBVJjQAxfxPya0dvzwG5WqqYsNXhINknkIK+gfZlt7 B9r3Us7gUI9gb7tp7SxSLuZ7OONliKiq/iu/DDyYb/5VTflQz8xXlk98SbUuxfAb0//r ys/KS+fUM5ToXmeVMj3L7No08JdFN3JwKqyWk= Received: by 10.224.212.134 with SMTP id gs6mr29150045qab.32.1326998715284; Thu, 19 Jan 2012 10:45:15 -0800 (PST) Received: from localhost (wal016.wlan.sas.upenn.edu. [128.91.71.145]) by mx.google.com with ESMTPS id hv20sm1294566qab.22.2012.01.19.10.45.14 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 19 Jan 2012 10:45:14 -0800 (PST) Sender: Aaron Ecay From: Aaron Ecay To: Adam Wolfe Gordon , notmuch@notmuchmail.org Subject: Re: [PATCH v3 5/5] emacs: Use message-citation-line-format in reply In-Reply-To: <1326995217-27423-6-git-send-email-awg+notmuch@xvx.ca> References: <1326995217-27423-1-git-send-email-awg+notmuch@xvx.ca> <1326995217-27423-6-git-send-email-awg+notmuch@xvx.ca> User-Agent: Notmuch/0.11+73~gd51b784 (http://notmuchmail.org) Emacs/24.0.92.2 (i386-apple-darwin10.8.0) Date: Thu, 19 Jan 2012 13:45:12 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jan 2012 18:45:16 -0000 On Thu, 19 Jan 2012 10:46:57 -0700, Adam Wolfe Gordon = 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(-) >=20 > 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))) >=20=20 > - (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=E2=80=99t 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 =E2=80=9C>= =E2=80=9D, ...). 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=E2=80=99s 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" . --=20 Aaron Ecay