[PATCH 1/9] lib: read "property" terms from messages.
[notmuch-archives.git] / 3e / 04a2bf12a47ddfdf42fa68bd2556748de4a49e
1 Return-Path: <awg@lagos.xvx.ca>\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 40FBE429E3B\r
6         for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 17:19:08 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id OFq-mhMlKrLt for <notmuch@notmuchmail.org>;\r
16         Mon, 16 Jan 2012 17:19:07 -0800 (PST)\r
17 Received: from idcmail-mo2no.shaw.ca (idcmail-mo2no.shaw.ca [64.59.134.9])\r
18         by olra.theworths.org (Postfix) with ESMTP id AED2A429E35\r
19         for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 17:19:07 -0800 (PST)\r
20 Received: from lb7f8hsrpno-svcs.dcs.int.inet (HELO pd6ml3no-ssvc.prod.shaw.ca)\r
21         ([10.0.144.222])\r
22         by pd6mo1no-svcs.prod.shaw.ca with ESMTP; 16 Jan 2012 18:19:05 -0700\r
23 X-Cloudmark-SP-Filtered: true\r
24 X-Cloudmark-SP-Result: v=1.1 cv=gFGh1ScE7ROJHT2jhivHYaSHya8441O0LZB7wkhlVyo=\r
25         c=1 sm=1\r
26         a=uWECbD2RVlEA:10 a=BLceEmwcHowA:10 a=yQp6g8lIsgqumF79BAsFDg==:17\r
27         a=Y2B7Pfn4WVGIM53Y2qsA:9 a=2_Xq26Wg9FFebKwHAtUA:7\r
28         a=HpAAvcLHHh0Zw7uRqdWCyQ==:117\r
29 Received: from unknown (HELO lagos.xvx.ca) ([96.52.216.56])\r
30         by pd6ml3no-dmz.prod.shaw.ca with ESMTP; 16 Jan 2012 18:19:05 -0700\r
31 Received: by lagos.xvx.ca (Postfix, from userid 1000)\r
32         id A8E828004208; Mon, 16 Jan 2012 18:19:05 -0700 (MST)\r
33 From: Adam Wolfe Gordon <awg+notmuch@xvx.ca>\r
34 To: notmuch@notmuchmail.org\r
35 Subject: [PATCH v2 5/4] emacs: Add customization for the first line of quotes.\r
36 Date: Mon, 16 Jan 2012 18:18:59 -0700\r
37 Message-Id: <1326763139-31146-1-git-send-email-awg+notmuch@xvx.ca>\r
38 X-Mailer: git-send-email 1.7.5.4\r
39 In-Reply-To: <1326737603-21166-1-git-send-email-awg+notmuch@xvx.ca>\r
40 References: <1326737603-21166-1-git-send-email-awg+notmuch@xvx.ca>\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Tue, 17 Jan 2012 01:19:08 -0000\r
54 \r
55 Add a customization option, notmuch-mua-reply-quoth, which controls\r
56 the first line of the reply body (typically, "On %date%, %from% wrote:").\r
57 This allows users who like other styles or correspond in other languages\r
58 to set an appropriate line using any of the quoted message's headers.\r
59 ---\r
60 \r
61 Due to some subsequent discussions in the thread about my original patch series,\r
62 I decided I may as well implement this sooner rather than later.\r
63 \r
64  emacs/notmuch-mua.el |   16 ++++++++++++----\r
65  1 files changed, 12 insertions(+), 4 deletions(-)\r
66 \r
67 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
68 index b03c62c..c7fd9f8 100644\r
69 --- a/emacs/notmuch-mua.el\r
70 +++ b/emacs/notmuch-mua.el\r
71 @@ -91,6 +91,14 @@ list."\r
72        (fill-region (point-min) (point-max))\r
73        (buffer-substring (point-min) (point-max)))))\r
74  \r
75 +(defcustom notmuch-mua-reply-quoth "On %date%, %from% wrote:"\r
76 +  "The first line of a reply body, typically 'On %date%, %from% wrote:'.\r
77 +\r
78 +Any header fields from the message being replied to can be inserted by\r
79 +enclosing them in percents."\r
80 +  :group 'notmuch\r
81 +  :type 'string)\r
82 +\r
83  (defun notmuch-mua-reply (query-string &optional sender reply-all)\r
84    (let ((args '("reply" "--format=json"))\r
85         reply\r
86 @@ -132,10 +140,10 @@ list."\r
87           (forward-line -1)\r
88         (goto-char (point-max)))\r
89  \r
90 -      (insert (format "On %s, %s wrote:\n"\r
91 -                     (cdr (assq 'date original-headers))\r
92 -                     (cdr (assq 'from original-headers))))\r
93 -          \r
94 +      (let ((quoth (replace-regexp-in-string "%.+?%" \r
95 +                                            (lambda (hdr) (cdr (assq (intern (substring hdr 1 (- (length hdr) 1))) original-headers)))\r
96 +                                            notmuch-mua-reply-quoth)))\r
97 +       (insert quoth "\n"))\r
98  \r
99        (if (null plain-parts)\r
100           (mapc (lambda (part) (notmuch-mua-insert-part-quoted (notmuch-mua-parse-html-part part))) html-parts)\r
101 -- \r
102 1.7.5.4\r
103 \r