Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 7e / 6b29f28c9e125d5c9781d70ade3ae5246aaf03
1 Return-Path: <aaronecay@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 78961431FAF\r
6         for <notmuch@notmuchmail.org>; Thu, 19 Jan 2012 10:45:16 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.699\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001,\r
13         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id a0bS7wgOPDAU for <notmuch@notmuchmail.org>;\r
17         Thu, 19 Jan 2012 10:45:15 -0800 (PST)\r
18 Received: from mail-qw0-f46.google.com (mail-qw0-f46.google.com\r
19         [209.85.216.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id CA158431FAE\r
22         for <notmuch@notmuchmail.org>; Thu, 19 Jan 2012 10:45:15 -0800 (PST)\r
23 Received: by qadc10 with SMTP id c10so2768912qad.5\r
24         for <notmuch@notmuchmail.org>; Thu, 19 Jan 2012 10:45:15 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=sender:from:to:subject:in-reply-to:references:user-agent:date\r
27         :message-id:mime-version:content-type:content-transfer-encoding;\r
28         bh=A9ddyFh3vqOB6PEKqLfL0cvLomX7aZAZTZLtFbwuflU=;\r
29         b=WAwq/wMdd8FsXEKjtuUQ1ZhewBVJjQAxfxPya0dvzwG5WqqYsNXhINknkIK+gfZlt7\r
30         B9r3Us7gUI9gb7tp7SxSLuZ7OONliKiq/iu/DDyYb/5VTflQz8xXlk98SbUuxfAb0//r\r
31         ys/KS+fUM5ToXmeVMj3L7No08JdFN3JwKqyWk=\r
32 Received: by 10.224.212.134 with SMTP id gs6mr29150045qab.32.1326998715284;\r
33         Thu, 19 Jan 2012 10:45:15 -0800 (PST)\r
34 Received: from localhost (wal016.wlan.sas.upenn.edu. [128.91.71.145])\r
35         by mx.google.com with ESMTPS id hv20sm1294566qab.22.2012.01.19.10.45.14\r
36         (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Thu, 19 Jan 2012 10:45:14 -0800 (PST)\r
38 Sender: Aaron Ecay <aaronecay@gmail.com>\r
39 From: Aaron Ecay <ecay@sas.upenn.edu>\r
40 To: Adam Wolfe Gordon <awg+notmuch@xvx.ca>, notmuch@notmuchmail.org\r
41 Subject: Re: [PATCH v3 5/5] emacs: Use message-citation-line-format in reply\r
42 In-Reply-To: <1326995217-27423-6-git-send-email-awg+notmuch@xvx.ca>\r
43 References: <1326995217-27423-1-git-send-email-awg+notmuch@xvx.ca>\r
44         <1326995217-27423-6-git-send-email-awg+notmuch@xvx.ca>\r
45 User-Agent: Notmuch/0.11+73~gd51b784 (http://notmuchmail.org) Emacs/24.0.92.2\r
46         (i386-apple-darwin10.8.0)\r
47 Date: Thu, 19 Jan 2012 13:45:12 -0500\r
48 Message-ID: <m2k44n4jlz.fsf@wal122.wireless-pennnet.upenn.edu>\r
49 MIME-Version: 1.0\r
50 Content-Type: text/plain; charset=utf-8\r
51 Content-Transfer-Encoding: quoted-printable\r
52 X-BeenThere: notmuch@notmuchmail.org\r
53 X-Mailman-Version: 2.1.13\r
54 Precedence: list\r
55 List-Id: "Use and development of the notmuch mail system."\r
56         <notmuch.notmuchmail.org>\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
60 List-Post: <mailto:notmuch@notmuchmail.org>\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
64 X-List-Received-Date: Thu, 19 Jan 2012 18:45:16 -0000\r
65 \r
66 On Thu, 19 Jan 2012 10:46:57 -0700, Adam Wolfe Gordon <awg+notmuch@xvx.ca> =\r
67 wrote:\r
68 > Instead of using a static citation line for the first line of the\r
69 > reply message, use the customizable one defined by message-mode.\r
70 > This makes it easy for users to customize the reply style, and\r
71 > retains consistency for users with existing message-mode\r
72 > customizations.\r
73 > ---\r
74 >  emacs/notmuch-mua.el |   19 ++++++++++++++++---\r
75 >  test/emacs           |    2 +-\r
76 >  2 files changed, 17 insertions(+), 4 deletions(-)\r
77 >=20\r
78 > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
79 > index 5ae0ccf..e485d93 100644\r
80 > --- a/emacs/notmuch-mua.el\r
81 > +++ b/emacs/notmuch-mua.el\r
82 > @@ -134,9 +134,22 @@ list."\r
83 >         (forward-line -1)\r
84 >       (goto-char (point-max)))\r
85 >=20=20\r
86 > -      (insert (format "On %s, %s wrote:\n"\r
87 > -                   (cdr (assq 'date original-headers))\r
88 > -                   (cdr (assq 'from original-headers))))\r
89 > +      (let* ((quoth message-citation-line-format)\r
90 > +          (case-fold-search nil)\r
91 > +          (full-from (cdr (assq 'from original-headers)))\r
92 > +          (from-addr (car (mail-header-parse-address full-from)))\r
93 > +          (from-name (cdr (mail-header-parse-address full-from)))\r
94 > +          (first-name (car (split-string from-name)))\r
95 > +          (last-name (append (cdr (split-string from-name))))\r
96 > +          (time (date-to-time (cdr (assq 'date original-headers)))))\r
97 > +\r
98 > +     (setq quoth (replace-regexp-in-string "%f" full-from quoth t t))\r
99 > +     (setq quoth (replace-regexp-in-string "%n" from-addr quoth t t))\r
100 > +     (setq quoth (replace-regexp-in-string "%N" from-name quoth t t))\r
101 > +     (setq quoth (replace-regexp-in-string "%F" first-name quoth t t))\r
102 > +     (setq quoth (replace-regexp-in-string "%L" last-name quoth t t))\r
103 > +     (setq quoth (format-time-string quoth time))\r
104 > +     (insert quoth))\r
105 \r
106 Shouldn=E2=80=99t this just use message-insert-formatted-citation-line?\r
107 \r
108 Another approach you might take with this patch series is to look at\r
109 the message-cite-original function (which I just discovered as I was\r
110 plumbing around in message.el looking for the function to format the\r
111 citation line).  I think that what one does to use this fn is to put\r
112 the original message text into the reply buffer (unquoted), set point\r
113 and mark to encompass it, then call the fn.  It automatically handles\r
114 inserting the quotes, and has some customization options (stripping\r
115 signatures from replies, customizable quote character instead of =E2=80=9C>=\r
116 =E2=80=9D,\r
117 ...).\r
118 \r
119 The message-cite-original function also adds escape characters to the\r
120 cookies that message-mode uses to indicate sign/encrypt/attach\r
121 directives.  I think notmuch exposes files on the user=E2=80=99s computer to\r
122 others, if a user can be tricked into replying to a message with an\r
123 attachment cookie and not stripping the cookie from the reply text.  So\r
124 to mitigate this, whatever reply mechanism winds up being used should\r
125 call mml-quote-region on the reply text (as message-cite-original does).\r
126 \r
127 I just sent a patch to the list to do this in the current version of\r
128 notmuch, which should show up in\r
129 id:"1326998589-37187-1-git-send-email-aaronecay@gmail.com" .\r
130 \r
131 --=20\r
132 Aaron Ecay\r