[PATCH 07/11] lib: Implement ghost-based thread linking
[notmuch-archives.git] / e3 / 1ccc53656631f4a9f217e7413f11fc3bfc025c
1 Return-Path: <amdragon@mit.edu>\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 2CA68429E4E\r
6         for <notmuch@notmuchmail.org>; Sat, 14 Jul 2012 16:02: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: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 Aez32YVW5sxL for <notmuch@notmuchmail.org>;\r
16         Sat, 14 Jul 2012 16:02:28 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU\r
18         [18.9.25.13])\r
19         by olra.theworths.org (Postfix) with ESMTP id B32B7431E62\r
20         for <notmuch@notmuchmail.org>; Sat, 14 Jul 2012 16:02:26 -0700 (PDT)\r
21 X-AuditID: 1209190d-b7fd56d000000933-f7-5001fa8229f3\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
23         by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id F9.3C.02355.28AF1005; Sat, 14 Jul 2012 19:02:26 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q6EN2PR8015444; \r
27         Sat, 14 Jul 2012 19:02:25 -0400\r
28 Received: from drake.dyndns.org\r
29         (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
30         [209.6.116.242]) (authenticated bits=0)\r
31         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
32         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6EN2Ow3008497\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Sat, 14 Jul 2012 19:02:25 -0400 (EDT)\r
35 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
36         (envelope-from <amdragon@mit.edu>)\r
37         id 1SqBLz-0002GD-VQ; Sat, 14 Jul 2012 19:02:23 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH v3 5/8] emacs: Replace other search text properties with\r
41         result property\r
42 Date: Sat, 14 Jul 2012 19:02:17 -0400\r
43 Message-Id: <1342306940-7499-6-git-send-email-amdragon@mit.edu>\r
44 X-Mailer: git-send-email 1.7.10\r
45 In-Reply-To: <1342306940-7499-1-git-send-email-amdragon@mit.edu>\r
46 References: <1342140319-19859-1-git-send-email-amdragon@mit.edu>\r
47         <1342306940-7499-1-git-send-email-amdragon@mit.edu>\r
48 X-Brightmail-Tracker:\r
49  H4sIAAAAAAAAA+NgFjrKIsWRmVeSWpSXmKPExsUixCmqrNv0izHAYM8edos9+7wsVs/lsbh+\r
50         cyazA7PH3dNcHjtn3WX3eLbqFnMAcxSXTUpqTmZZapG+XQJXxpPLX9kLFklWTDpxnqmBcbJo\r
51         FyMnh4SAicS5nYfZIGwxiQv31gPZXBxCAvsYJb53fWWFcDYwSmxqboPKPGKSePRzGTOEM5dR\r
52         4nf/eXaQfjYBDYlt+5czgtgiAtISO+/OZgWxmQXSJL63vwWLCwtESOxetZ8ZxGYRUJX4vfAK\r
53         WA2vgL3E2XnXoe6Ql3h6vw/M5hRwkDh84QRYjZBAmcSNJ99ZJzDyL2BkWMUom5JbpZubmJlT\r
54         nJqsW5ycmJeXWqRrpJebWaKXmlK6iREcWpK8OxjfHVQ6xCjAwajEw5vqzxAgxJpYVlyZe4hR\r
55         koNJSZT39U/GACG+pPyUyozE4oz4otKc1OJDjBIczEoivBJfgXK8KYmVValF+TApaQ4WJXHe\r
56         Kyk3/YUE0hNLUrNTUwtSi2CyMhwcShK8hSBDBYtS01Mr0jJzShDSTBycIMN5gIafBKnhLS5I\r
57         zC3OTIfIn2JUlBLn7QVJCIAkMkrz4Hphsf+KURzoFWHepSBVPMC0Adf9CmgwE9DgWT//+QMN\r
58         LklESEk1MJbpnz6nfKosPvVXULJDjf5GBeMTHWk31gZqN/005+NMuN0csaPqiojwxX3H5zus\r
59         nSuxjHWN2XmBGXP3/dipaDp/xmGTKpfkS4wmsoLSpRtS1nSLJ6dNmGw250PW0hVx/zffyzrD\r
60         8qIrRP+D7M2/yrmbr93f5iFX1j+bJcn8zeMT+dIMd7U8WpVYijMSDbWYi4oTAY8DHqDYAgAA\r
61 X-BeenThere: notmuch@notmuchmail.org\r
62 X-Mailman-Version: 2.1.13\r
63 Precedence: list\r
64 List-Id: "Use and development of the notmuch mail system."\r
65         <notmuch.notmuchmail.org>\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
69 List-Post: <mailto:notmuch@notmuchmail.org>\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
72         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
73 X-List-Received-Date: Sat, 14 Jul 2012 23:02:30 -0000\r
74 \r
75 Since the result object contains everything that the other text\r
76 properties recorded, we can remove the other text properties and\r
77 simply look in the plist of the appropriate result object.\r
78 ---\r
79  emacs/notmuch.el |   24 ++++++++++--------------\r
80  1 file changed, 10 insertions(+), 14 deletions(-)\r
81 \r
82 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
83 index 49367e0..8590529 100644\r
84 --- a/emacs/notmuch.el\r
85 +++ b/emacs/notmuch.el\r
86 @@ -465,16 +465,18 @@ BEG."\r
87    (let (output)\r
88      (notmuch-search-foreach-result beg end\r
89        (lambda (pos)\r
90 -       (push (get-text-property pos property) output)))\r
91 +       (push (plist-get (notmuch-search-get-result pos) property) output)))\r
92      output))\r
93  \r
94  (defun notmuch-search-find-thread-id ()\r
95    "Return the thread for the current thread"\r
96 -  (get-text-property (point) 'notmuch-search-thread-id))\r
97 +  (let ((thread (plist-get (notmuch-search-get-result) :thread)))\r
98 +    (when thread (concat "thread:" thread))))\r
99  \r
100  (defun notmuch-search-find-thread-id-region (beg end)\r
101    "Return a list of threads for the current region"\r
102 -  (notmuch-search-properties-in-region 'notmuch-search-thread-id beg end))\r
103 +  (mapcar (lambda (thread) (concat "thread:" thread))\r
104 +         (notmuch-search-properties-in-region :thread beg end)))\r
105  \r
106  (defun notmuch-search-find-thread-id-region-search (beg end)\r
107    "Return a search string for threads for the current region"\r
108 @@ -482,19 +484,19 @@ BEG."\r
109  \r
110  (defun notmuch-search-find-authors ()\r
111    "Return the authors for the current thread"\r
112 -  (get-text-property (point) 'notmuch-search-authors))\r
113 +  (plist-get (notmuch-search-get-result) :authors))\r
114  \r
115  (defun notmuch-search-find-authors-region (beg end)\r
116    "Return a list of authors for the current region"\r
117 -  (notmuch-search-properties-in-region 'notmuch-search-authors beg end))\r
118 +  (notmuch-search-properties-in-region :authors beg end))\r
119  \r
120  (defun notmuch-search-find-subject ()\r
121    "Return the subject for the current thread"\r
122 -  (get-text-property (point) 'notmuch-search-subject))\r
123 +  (plist-get (notmuch-search-get-result) :subject))\r
124  \r
125  (defun notmuch-search-find-subject-region (beg end)\r
126    "Return a list of authors for the current region"\r
127 -  (notmuch-search-properties-in-region 'notmuch-search-subject beg end))\r
128 +  (notmuch-search-properties-in-region :subject beg end))\r
129  \r
130  (defun notmuch-search-show-thread ()\r
131    "Display the currently selected thread."\r
132 @@ -789,13 +791,7 @@ non-authors is found, assume that all of the authors match."\r
133           (notmuch-search-insert-field (car spec) (cdr spec) result))\r
134         (insert "\n")\r
135         (notmuch-search-color-line beg (point) (plist-get result :tags))\r
136 -       (put-text-property beg (point) 'notmuch-search-result result)\r
137 -       (put-text-property beg (point) 'notmuch-search-thread-id\r
138 -                          (concat "thread:" (plist-get result :thread)))\r
139 -       (put-text-property beg (point) 'notmuch-search-authors\r
140 -                          (plist-get result :authors))\r
141 -       (put-text-property beg (point) 'notmuch-search-subject\r
142 -                          (plist-get result :subject)))\r
143 +       (put-text-property beg (point) 'notmuch-search-result result))\r
144        (when (string= (plist-get result :thread) notmuch-search-target-thread)\r
145         (setq notmuch-search-target-thread "found")\r
146         (goto-char beg)))))\r
147 -- \r
148 1.7.10\r
149 \r