Re: Linking a privately built -lxapian
[notmuch-archives.git] / 9f / 8dc4e00775126478ec5bf5b94dccf20a6449d3
1 Return-Path: <dme@dme.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 B6122429E29\r
6         for <notmuch@notmuchmail.org>; Fri, 24 Oct 2014 10:44:19 -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.699\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7, UNPARSEABLE_RELAY=0.001]\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 7pKTalzzxjNx for <notmuch@notmuchmail.org>;\r
17         Fri, 24 Oct 2014 10:44:14 -0700 (PDT)\r
18 Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com\r
19         [209.85.212.171]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 2F8CC431FD4\r
22         for <notmuch@notmuchmail.org>; Fri, 24 Oct 2014 10:44:10 -0700 (PDT)\r
23 Received: by mail-wi0-f171.google.com with SMTP id em10so1835055wid.10\r
24         for <notmuch@notmuchmail.org>; Fri, 24 Oct 2014 10:44:08 -0700 (PDT)\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
26         d=1e100.net; s=20130820;\r
27         h=x-gm-message-state:user-agent:from:to:subject:date:message-id\r
28         :in-reply-to:references;\r
29         bh=1QzqHNoTT+e5VIRb9bqb9Fbp8QK0Ume+uAAxTjqO3KY=;\r
30         b=iPE3gL4lxCGtaIvC0Nn84bOCyRjqsmb6xvTkvLubOlX2BvY8OrMYTE4Q6Tz8xaCau+\r
31         2dJL60F4VeFoeSbXE8zlPdO3NYhpX4yOjnQUteVbIoP01Aiug/hcaQO/VHAvf9InZqcg\r
32         HIzEKM10UYjYdBovzlbp8CTPHmEvATy8JA+zbS9Ly56FZDFKgLiF1SyVbNAr2s87vDmb\r
33         ULzh3nDfIGH9RC5xkGhslBhMW9E4x6Ns8NFNWIP+McAt3k07PG4M4g3IIQKxsKvUPcPd\r
34         9d9ZnPPzDPT4/qsUDlk29+ehpm56fY8X6BAE30Q+OAmVD1PkdJpRJjHw5xQmreYYVyfX\r
35         CKew==\r
36 X-Gm-Message-State:\r
37  ALoCoQlYiVRaQVc9Ich2jDoB3aKeNx9OGfS00KoI95pV/I1hnZGG5+bdDY4W+urE3ZiCcIt17qe7\r
38 X-Received: by 10.194.91.176 with SMTP id cf16mr6320061wjb.60.1414172648571;\r
39         Fri, 24 Oct 2014 10:44:08 -0700 (PDT)\r
40 Received: from disaster-area.hh.sledj.net\r
41         ([2a01:348:1a2:1:ea39:35ff:fe2c:a227])\r
42         by mx.google.com with ESMTPSA id u8sm2718196wiz.14.2014.10.24.10.44.07\r
43         for <notmuch@notmuchmail.org>\r
44         (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
45         Fri, 24 Oct 2014 10:44:07 -0700 (PDT)\r
46 Received: from localhost (30000@localhost [local]);\r
47         by localhost (OpenSMTPD) with ESMTPA id f60902d2;\r
48         for <notmuch@notmuchmail.org>; Fri, 24 Oct 2014 17:44:03 +0000 (UTC)\r
49 User-Agent: OpenSMTPD enqueuer (Demoostik)\r
50 From: David Edmondson <dme@dme.org>\r
51 To: notmuch@notmuchmail.org\r
52 Subject: [PATCH v2 2/3] emacs: Improved display of matching/non-matching\r
53         authors.\r
54 Date: Fri, 24 Oct 2014 18:44:02 +0100\r
55 Message-Id: <1414172643-28270-3-git-send-email-dme@dme.org>\r
56 X-Mailer: git-send-email 2.1.1\r
57 In-Reply-To: <1414172643-28270-1-git-send-email-dme@dme.org>\r
58 References: <1414172643-28270-1-git-send-email-dme@dme.org>\r
59 X-BeenThere: notmuch@notmuchmail.org\r
60 X-Mailman-Version: 2.1.13\r
61 Precedence: list\r
62 List-Id: "Use and development of the notmuch mail system."\r
63         <notmuch.notmuchmail.org>\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
67 List-Post: <mailto:notmuch@notmuchmail.org>\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
71 X-List-Received-Date: Fri, 24 Oct 2014 17:44:20 -0000\r
72 \r
73 Rather than splitting the :authors attribute, which is error prone,\r
74 use the separate :authors_matched and :authors_non_matched attributes.\r
75 \r
76 This improves the display of authors should one of them include a pipe\r
77 symbol (|) in their 'from' address.\r
78 ---\r
79  emacs/notmuch.el | 64 +++++++++++++++++++++++++++++++-------------------------\r
80  1 file changed, 35 insertions(+), 29 deletions(-)\r
81 \r
82 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
83 index b44a907..688b37c 100644\r
84 --- a/emacs/notmuch.el\r
85 +++ b/emacs/notmuch.el\r
86 @@ -672,22 +672,24 @@ foreground and blue background."\r
87         ;; Reverse the list so earlier entries take precedence\r
88         (reverse notmuch-search-line-faces)))\r
89  \r
90 -(defun notmuch-search-author-propertize (authors)\r
91 +(defun notmuch-search-author-propertize (authors matching-length)\r
92    "Split `authors' into matching and non-matching authors and\r
93  propertize appropriately. If no boundary between authors and\r
94  non-authors is found, assume that all of the authors match."\r
95 -  (if (string-match "\\(.*\\)|\\(.*\\)" authors)\r
96 -      (concat (propertize (concat (match-string 1 authors) ",")\r
97 -                         'face 'notmuch-search-matching-authors)\r
98 -             (propertize (match-string 2 authors)\r
99 -                         'face 'notmuch-search-non-matching-authors))\r
100 -    (propertize authors 'face 'notmuch-search-matching-authors)))\r
101 -\r
102 -(defun notmuch-search-insert-authors (format-string authors)\r
103 +  (let ((match-part (substring authors 0 matching-length))\r
104 +       (non-match-part (substring authors matching-length)))\r
105 +\r
106 +      (concat (propertize match-part 'face 'notmuch-search-matching-authors)\r
107 +             (propertize non-match-part 'face 'notmuch-search-non-matching-authors))))\r
108 +\r
109 +(defun notmuch-search-insert-authors (format-string matching-authors non-matching-authors)\r
110    ;; Save the match data to avoid interfering with\r
111    ;; `notmuch-search-process-filter'.\r
112    (save-match-data\r
113 -    (let* ((formatted-authors (format format-string authors))\r
114 +    (let* ((authors (if (string= "" non-matching-authors)\r
115 +                       matching-authors\r
116 +                     (concat matching-authors ", " non-matching-authors)))\r
117 +          (formatted-authors (format format-string authors))\r
118            (formatted-sample (format format-string ""))\r
119            (visible-string formatted-authors)\r
120            (invisible-string "")\r
121 @@ -703,9 +705,9 @@ non-authors is found, assume that all of the authors match."\r
122             (setq visible-string (substring formatted-authors 0 visible-length)\r
123                   invisible-string (substring formatted-authors visible-length))\r
124             ;; If possible, truncate the visible string at a natural\r
125 -           ;; break (comma or pipe), as incremental search doesn't\r
126 -           ;; match across the visible/invisible border.\r
127 -           (when (string-match "\\(.*\\)\\([,|] \\)\\([^,|]*\\)" visible-string)\r
128 +           ;; break (comma), as incremental search doesn't match\r
129 +           ;; across the visible/invisible border.\r
130 +           (when (string-match "\\(.*\\)\\(, \\)\\([^,]*\\)" visible-string)\r
131               ;; Second clause is destructive on `visible-string', so\r
132               ;; order is important.\r
133               (setq invisible-string (concat (match-string 3 visible-string)\r
134 @@ -721,20 +723,23 @@ non-authors is found, assume that all of the authors match."\r
135                                        ? ))))\r
136  \r
137        ;; Use different faces to show matching and non-matching authors.\r
138 -      (if (string-match "\\(.*\\)|\\(.*\\)" visible-string)\r
139 -         ;; The visible string contains both matching and\r
140 -         ;; non-matching authors.\r
141 -         (setq visible-string (notmuch-search-author-propertize visible-string)\r
142 -               ;; The invisible string must contain only non-matching\r
143 -               ;; authors, as the visible-string contains both.\r
144 -               invisible-string (propertize invisible-string\r
145 -                                            'face 'notmuch-search-non-matching-authors))\r
146 -       ;; The visible string contains only matching authors.\r
147 -       (setq visible-string (propertize visible-string\r
148 -                                        'face 'notmuch-search-matching-authors)\r
149 -             ;; The invisible string may contain both matching and\r
150 -             ;; non-matching authors.\r
151 -             invisible-string (notmuch-search-author-propertize invisible-string)))\r
152 +      (let ((visible-length (length visible-string))\r
153 +           (matching-length (length matching-authors)))\r
154 +\r
155 +       (if (> visible-length matching-length)\r
156 +           ;; The visible string contains both matching and\r
157 +           ;; non-matching authors.\r
158 +           (setq visible-string (notmuch-search-author-propertize visible-string matching-length)\r
159 +                 ;; The invisible string must contain only non-matching\r
160 +                 ;; authors, as the visible-string contains both.\r
161 +                 invisible-string (propertize invisible-string\r
162 +                                              'face 'notmuch-search-non-matching-authors))\r
163 +         ;; The visible string contains only matching authors.\r
164 +         (setq visible-string (propertize visible-string\r
165 +                                          'face 'notmuch-search-matching-authors)\r
166 +               ;; The invisible string may contain both matching and\r
167 +               ;; non-matching authors.\r
168 +               invisible-string (notmuch-search-author-propertize invisible-string (- visible-length matching-length)))))\r
169  \r
170        ;; If there is any invisible text, add it as a tooltip to the\r
171        ;; visible text.\r
172 @@ -768,8 +773,9 @@ non-authors is found, assume that all of the authors match."\r
173                         'face 'notmuch-search-subject)))\r
174  \r
175     ((string-equal field "authors")\r
176 -    (notmuch-search-insert-authors\r
177 -     format-string (notmuch-sanitize (plist-get result :authors))))\r
178 +    (notmuch-search-insert-authors format-string\r
179 +                                  (notmuch-sanitize (mapconcat 'identity (plist-get result :authors_matched) ", "))\r
180 +                                  (notmuch-sanitize (mapconcat 'identity (plist-get result :authors_non_matched) ", "))))\r
181  \r
182     ((string-equal field "tags")\r
183      (let ((tags (plist-get result :tags))\r
184 -- \r
185 2.1.1\r
186 \r