Re: notmuch for documents
[notmuch-archives.git] / 4b / ac7c55e2c0ad8ff569ec4121226160bfc4ffbc
1 Return-Path: <james@hackervisions.org>\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 293E449168F\r
6         for <notmuch@notmuchmail.org>; Tue,  9 Mar 2010 11:41:18 -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.101\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.101 tagged_above=-999 required=5\r
12         tests=[BAYES_50=0.001, RDNS_DYNAMIC=0.1] autolearn=no\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 gisWoB097BJd for <notmuch@notmuchmail.org>;\r
16         Tue,  9 Mar 2010 11:41:17 -0800 (PST)\r
17 Received: from hackervisions.org (67-207-143-141.slicehost.net\r
18         [67.207.143.141])\r
19         by olra.theworths.org (Postfix) with ESMTP id B168B476B9A\r
20         for <notmuch@notmuchmail.org>; Tue,  9 Mar 2010 11:41:17 -0800 (PST)\r
21 Received: from ool-4572a809.dyn.optonline.net ([69.114.168.9] helo=localhost)\r
22         by hv with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69)\r
23         (envelope-from <james@hackervisions.org>) id 1Np5Ib-0006AW-83\r
24         for notmuch@notmuchmail.org; Tue, 09 Mar 2010 14:41:01 -0500\r
25 From: James Vasile <james@hackervisions.org>\r
26 To: notmuch@notmuchmail.org\r
27 Date: Tue, 09 Mar 2010 14:40:59 -0500\r
28 Message-ID: <87aauhp9kk.fsf@hackervisions.org>\r
29 MIME-Version: 1.0\r
30 Content-Type: text/plain; charset=us-ascii\r
31 Subject: [notmuch] [PATCH] Change From and Bcc when creating reply draft\r
32         buffer\r
33 X-BeenThere: notmuch@notmuchmail.org\r
34 X-Mailman-Version: 2.1.13\r
35 Precedence: list\r
36 List-Id: "Use and development of the notmuch mail system."\r
37         <notmuch.notmuchmail.org>\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
39         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
41 List-Post: <mailto:notmuch@notmuchmail.org>\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
45 X-List-Received-Date: Tue, 09 Mar 2010 19:41:18 -0000\r
46 \r
47 When notmuch creates a reply buffer, it guesses the From and Bcc\r
48 addresses.  The client is in a better position to guess these, and this\r
49 patch adjusts notmuch-reply accordingly.\r
50 \r
51 diff --git a/notmuch.el b/notmuch.el\r
52 index ab56f48..07f957e 100644\r
53 --- a/notmuch.el\r
54 +++ b/notmuch.el\r
55 @@ -436,10 +436,20 @@ buffer."\r
56    (message "Done"))\r
57  \r
58  (defun notmuch-reply (query-string)\r
59 +  "Prepare a reply draft buffer.\r
60 +\r
61 +Have notmuch create a reply buffer, then adjust the from and bcc\r
62 +headers to match our current user-full-name and\r
63 +user-mail-address."\r
64    (switch-to-buffer (generate-new-buffer "notmuch-draft"))\r
65    (call-process notmuch-command nil t nil "reply" query-string)\r
66    (message-insert-signature)\r
67    (goto-char (point-min))\r
68 +  (kill-line)\r
69 +  (insert (format "From: %s <%s>" user-full-name user-mail-address))\r
70 +  (re-search-forward "^Bcc: " nil t)\r
71 +  (kill-line)\r
72 +  (insert (format "%s <%s>" user-full-name user-mail-address))\r
73    (if (re-search-forward "^$" nil t)\r
74        (progn\r
75         (insert "--text follows this line--")\r