Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / bd / de731a5763ff838be32afcca3f612cd642e1d2
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 EDB76429E3F\r
6         for <notmuch@notmuchmail.org>; Sat, 14 Jul 2012 16:02:27 -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 X5q-oqlQG+CP for <notmuch@notmuchmail.org>;\r
16         Sat, 14 Jul 2012 16:02:27 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU\r
18         [18.9.25.12])\r
19         by olra.theworths.org (Postfix) with ESMTP id A62E9431FBD\r
20         for <notmuch@notmuchmail.org>; Sat, 14 Jul 2012 16:02:26 -0700 (PDT)\r
21 X-AuditID: 1209190c-b7f806d000006b87-c4-5001fa82f798\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 42.FE.27527.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-2.mit.edu (8.13.8/8.9.2) with ESMTP id q6EN2PZw031811; \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 q6EN2N6e008493\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Sat, 14 Jul 2012 19:02:24 -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-0002G3-OA; 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 1/8] emacs: Record thread search result object in a text\r
41         property\r
42 Date: Sat, 14 Jul 2012 19:02:13 -0400\r
43 Message-Id: <1342306940-7499-2-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+NgFjrKIsWRmVeSWpSXmKPExsUixG6notv0izHA4Mwnbos9+7wsVs/lsbh+\r
50         cyazA7PH3dNcHjtn3WX3eLbqFnMAcxSXTUpqTmZZapG+XQJXRs/ih2wFqwQrZmy7xtrAOJOv\r
51         i5GTQ0LARGL5v7dsELaYxIV764FsLg4hgX2MEl+PrIFyNjBKzNwzmQnCecQkMeHFEUYIZy6j\r
52         xM59XSwg/WwCGhLb9i9nBLFFBKQldt6dzQpiMwukSXxvfwsWFxYIkbgx9ws7iM0ioCrxZVk7\r
53         WA2vgL3EpsvvmCHukJd4er8P7CZOAQeJwxdOgNUICZRJ3HjynXUCI/8CRoZVjLIpuVW6uYmZ\r
54         OcWpybrFyYl5ealFuoZ6uZkleqkppZsYQaHFKcmzg/HNQaVDjAIcjEo8vOn+DAFCrIllxZW5\r
55         hxglOZiURHlf/2QMEOJLyk+pzEgszogvKs1JLT7EKMHBrCTCK/EVKMebklhZlVqUD5OS5mBR\r
56         Eue9nHLTX0ggPbEkNTs1tSC1CCYrw8GhJMFbCDJUsCg1PbUiLTOnBCHNxMEJMpwHaHg3SA1v\r
57         cUFibnFmOkT+FKOilDhvL0hCACSRUZoH1wuL/VeM4kCvCPMuBaniAaYNuO5XQIOZgAbP+vnP\r
58         H2hwSSJCSqqBMcNsjxPvkY1n7VW9GspVGy/abnTycszT2M/1dmFF8czr/hoHojZV7WOx3G3m\r
59         Lsm4Jn3duY9ZF/7vrncPu5/yhGfGnYjNHpfqy3nX91yc7qrPfCaRoV8w7mmiZ0L1+28Zkr+Y\r
60         tacntptvkBZr2GnGvKz4mubfST+ZjGv65RanCDcW/7puuZRXiaU4I9FQi7moOBEA8FaDLdgC        AAA=\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:28 -0000\r
74 \r
75 This also provides utility functions for working with this text\r
76 property that get its value, find its start, and find its end.\r
77 ---\r
78  emacs/notmuch.el |   27 +++++++++++++++++++++++++++\r
79  1 file changed, 27 insertions(+)\r
80 \r
81 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
82 index fabb7c0..ef18927 100644\r
83 --- a/emacs/notmuch.el\r
84 +++ b/emacs/notmuch.el\r
85 @@ -401,6 +401,32 @@ Complete list of currently available key bindings:\r
86         mode-name "notmuch-search")\r
87    (setq buffer-read-only t))\r
88  \r
89 +(defun notmuch-search-get-result (&optional pos)\r
90 +  "Return the result object for the thread at POS (or point).\r
91 +\r
92 +If there is no thread at POS (or point), returns nil."\r
93 +  (get-text-property (or pos (point)) 'notmuch-search-result))\r
94 +\r
95 +(defun notmuch-search-result-beginning (&optional pos)\r
96 +  "Return the point at the beginning of the thread at POS (or point).\r
97 +\r
98 +If there is no thread at POS (or point), returns nil."\r
99 +  (when (notmuch-search-get-result pos)\r
100 +    ;; We pass 1+point because previous-single-property-change starts\r
101 +    ;; searching one before the position we give it.\r
102 +    (previous-single-property-change (1+ (or pos (point)))\r
103 +                                    'notmuch-search-result nil (point-min))))\r
104 +\r
105 +(defun notmuch-search-result-end (&optional pos)\r
106 +  "Return the point at the end of the thread at POS (or point).\r
107 +\r
108 +The returned point will be just after the newline character that\r
109 +ends the result line.  If there is no thread at POS (or point),\r
110 +returns nil"\r
111 +  (when (notmuch-search-get-result pos)\r
112 +    (next-single-property-change (or pos (point)) 'notmuch-search-result\r
113 +                                nil (point-max))))\r
114 +\r
115  (defun notmuch-search-properties-in-region (property beg end)\r
116    (save-excursion\r
117      (let ((output nil)\r
118 @@ -736,6 +762,7 @@ non-authors is found, assume that all of the authors match."\r
119           (notmuch-search-insert-field (car spec) (cdr spec) result))\r
120         (insert "\n")\r
121         (notmuch-search-color-line beg (point) (plist-get result :tags))\r
122 +       (put-text-property beg (point) 'notmuch-search-result result)\r
123         (put-text-property beg (point) 'notmuch-search-thread-id\r
124                            (concat "thread:" (plist-get result :thread)))\r
125         (put-text-property beg (point) 'notmuch-search-authors\r
126 -- \r
127 1.7.10\r
128 \r