v3 of message properties patches
[notmuch-archives.git] / fc / af9a93f893bbfa3cfca8ba036195660ef19b8f
1 Return-Path: <jrollins@servo.finestructure.net>\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 403B7431FB6\r
6         for <notmuch@notmuchmail.org>; Sat, 28 May 2011 14:52:30 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.921\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.921 tagged_above=-999 required=5\r
12         tests=[NO_DNS_FOR_FROM=0.379, RCVD_IN_DNSWL_MED=-2.3]\r
13         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 KT+-GwRew9Q8 for <notmuch@notmuchmail.org>;\r
17         Sat, 28 May 2011 14:52:29 -0700 (PDT)\r
18 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
19         [131.215.239.19])\r
20         by olra.theworths.org (Postfix) with ESMTP id D4444429E25\r
21         for <notmuch@notmuchmail.org>; Sat, 28 May 2011 14:52:16 -0700 (PDT)\r
22 Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
23         by fire-doxen-postvirus (Postfix) with ESMTP id 58D2B2E50EB3;\r
24         Sat, 28 May 2011 14:45:49 -0700 (PDT)\r
25 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
26 Received: from servo.finestructure.net (cpe-98-149-172-122.socal.res.rr.com\r
27         [98.149.172.122]) (Authenticated sender: jrollins)\r
28         by fire-doxen-submit (Postfix) with ESMTP id 80359328142;\r
29         Sat, 28 May 2011 14:45:45 -0700 (PDT)\r
30 Received: by servo.finestructure.net (Postfix, from userid 1000)\r
31         id 447407E9; Sat, 28 May 2011 14:52:05 -0700 (PDT)\r
32 From: Jameson Graef Rollins <jrollins@finestructure.net>\r
33 To: Notmuch Mail <notmuch@notmuchmail.org>\r
34 Subject: [PATCH 15/25] Use message-field-value instead of message-fetch-field\r
35         in FCC header setup.\r
36 Date: Sat, 28 May 2011 14:51:50 -0700\r
37 Message-Id: <1306619520-25730-16-git-send-email-jrollins@finestructure.net>\r
38 X-Mailer: git-send-email 1.7.4.4\r
39 In-Reply-To: <1306619520-25730-15-git-send-email-jrollins@finestructure.net>\r
40 References: <1306619520-25730-1-git-send-email-jrollins@finestructure.net>\r
41         <1306619520-25730-2-git-send-email-jrollins@finestructure.net>\r
42         <1306619520-25730-3-git-send-email-jrollins@finestructure.net>\r
43         <1306619520-25730-4-git-send-email-jrollins@finestructure.net>\r
44         <1306619520-25730-5-git-send-email-jrollins@finestructure.net>\r
45         <1306619520-25730-6-git-send-email-jrollins@finestructure.net>\r
46         <1306619520-25730-7-git-send-email-jrollins@finestructure.net>\r
47         <1306619520-25730-8-git-send-email-jrollins@finestructure.net>\r
48         <1306619520-25730-9-git-send-email-jrollins@finestructure.net>\r
49         <1306619520-25730-10-git-send-email-jrollins@finestructure.net>\r
50         <1306619520-25730-11-git-send-email-jrollins@finestructure.net>\r
51         <1306619520-25730-12-git-send-email-jrollins@finestructure.net>\r
52         <1306619520-25730-13-git-send-email-jrollins@finestructure.net>\r
53         <1306619520-25730-14-git-send-email-jrollins@finestructure.net>\r
54         <1306619520-25730-15-git-send-email-jrollins@finestructure.net>\r
55 X-BeenThere: notmuch@notmuchmail.org\r
56 X-Mailman-Version: 2.1.13\r
57 Precedence: list\r
58 List-Id: "Use and development of the notmuch mail system."\r
59         <notmuch.notmuchmail.org>\r
60 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
62 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
63 List-Post: <mailto:notmuch@notmuchmail.org>\r
64 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
65 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
67 X-List-Received-Date: Sat, 28 May 2011 21:52:30 -0000\r
68 \r
69 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
70 \r
71 For message-fetch-field the buffer is expected to be narrowed to\r
72 just the header of the message.  That is not the case when\r
73 notmuch-fcc-header-setup is run, hence a wrong header value may be\r
74 returned.  E.g. when forwarding an\r
75 email, (message-fetch-field "From") returns the From header value\r
76 of the forwarded email.\r
77 \r
78 Message-field-value is the same as message-fetch-field, only\r
79 narrows the buffer to the headers first.\r
80 \r
81 Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>\r
82 ---\r
83  emacs/notmuch-maildir-fcc.el |    6 +++---\r
84  1 files changed, 3 insertions(+), 3 deletions(-)\r
85 \r
86 diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el\r
87 index b79f6a3..b6c6e2a 100644\r
88 --- a/emacs/notmuch-maildir-fcc.el\r
89 +++ b/emacs/notmuch-maildir-fcc.el\r
90 @@ -80,7 +80,7 @@ will NOT be removed or replaced."\r
91    (let ((subdir\r
92          (cond\r
93           ((or (not notmuch-fcc-dirs)\r
94 -              (message-fetch-field "Fcc"))\r
95 +              (message-field-value "Fcc"))\r
96            ;; Nothing set or an existing header.\r
97            nil)\r
98  \r
99 @@ -93,7 +93,7 @@ will NOT be removed or replaced."\r
100            (error "Invalid `notmuch-fcc-dirs' setting (old style)"))\r
101  \r
102           ((listp notmuch-fcc-dirs)\r
103 -          (let* ((from (message-fetch-field "From"))\r
104 +          (let* ((from (message-field-value "From"))\r
105                   (match\r
106                    (catch 'first-match\r
107                      (dolist (re-folder notmuch-fcc-dirs)\r
108 @@ -118,7 +118,7 @@ will NOT be removed or replaced."\r
109                   (concat (notmuch-database-path) "/" subdir)))))\r
110        \r
111        ;; finally test if fcc points to a valid maildir\r
112 -      (let ((fcc-header (message-fetch-field "Fcc")))\r
113 +      (let ((fcc-header (message-field-value "Fcc")))\r
114         (unless (notmuch-maildir-fcc-dir-is-maildir-p fcc-header)\r
115           (cond ((not (file-writable-p fcc-header))\r
116                  (error (format "No permission to create %s, which does not exist"\r
117 -- \r
118 1.7.4.4\r
119 \r