Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 10 / 00a4aeb9d4ef704cefbfc6ce0ea42064450fdf
1 Return-Path: <alex.boterolowry@gmail.com>\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 44228431FBC\r
6         for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 21:24:12 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id IiFj36NLLJAG for <notmuch@notmuchmail.org>;\r
11         Tue, 24 Nov 2009 21:24:11 -0800 (PST)\r
12 Received: from mail-yw0-f200.google.com (mail-yw0-f200.google.com\r
13         [209.85.211.200])\r
14         by olra.theworths.org (Postfix) with ESMTP id 83ED0431FAE\r
15         for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 21:24:11 -0800 (PST)\r
16 Received: by ywh38 with SMTP id 38so6685448ywh.6\r
17         for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 21:24:11 -0800 (PST)\r
18 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
19         h=domainkey-signature:received:received:received:from:to:subject\r
20         :in-reply-to:references:date:message-id:mime-version:content-type;\r
21         bh=EVgPASpy/G7L2S8T/Pcyx12L6l8s7Si9ZGlKwM9b/zA=;\r
22         b=JrawpXxaaKSu4TUx5aWdQkCn4q6J6YYBM1iVvboYPcjscxNoPF8VcUz+RT2a5PFD5L\r
23         aXePKm75leYppqoXKhg0JSd0/InNn1Uzkt+r6ittQL764DZ7QclJKCpx4MwDIUmajC1U\r
24         ycaZINUqJ7tsTjyIUZTHtjeGcphwGr3XeHcLM=\r
25 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
26         h=from:to:subject:in-reply-to:references:date:message-id:mime-version\r
27         :content-type;\r
28         b=eY+n/+IR88yykPTFzG0ZUtsBIhiHimOjC+rse/Ii5KRGBRPa59MwjKAZWvxNlBQ+iI\r
29         rrrUSoYAhuHM/F4HYpbvlY2XzEkQNPh0Ae5c05T8XxIA0julS1kFqsCTsaelVyOOmpJI\r
30         DFpp4IvVpJxEI0Op/2vONkYXnivl6fPUn8f9o=\r
31 Received: by 10.150.172.38 with SMTP id u38mr12673360ybe.328.1259126644847;\r
32         Tue, 24 Nov 2009 21:24:04 -0800 (PST)\r
33 Received: from fortitudo (70-36-144-85.dsl.dynamic.sonic.net [70.36.144.85])\r
34         by mx.google.com with ESMTPS id 15sm2944590gxk.4.2009.11.24.21.24.03\r
35         (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
36         Tue, 24 Nov 2009 21:24:03 -0800 (PST)\r
37 Received: from alexbl (uid 1001) (envelope-from\r
38         alexbl@fortitudo.i-did-not-set--mail-host-address--so-tickle-me)\r
39         id 7037 by fortitudo (DragonFly Mail Agent)\r
40         Tue, 24 Nov 2009 21:24:08 -0800\r
41 From: Alexander Botero-Lowry <alex.boterolowry@gmail.com>\r
42 To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,\r
43         notmuch@notmuchmail.org\r
44 In-Reply-To:\r
45  <1259125080-18708-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>\r
46 References:\r
47  <1259125080-18708-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>\r
48 Date: Tue, 24 Nov 2009 21:24:07 -0800\r
49 Message-ID:\r
50  <86fx83qirs.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me>\r
51 MIME-Version: 1.0\r
52 Content-Type: text/plain; charset=us-ascii\r
53 Subject: Re: [notmuch] [PATCH -v4] notmuch.el: Add face support to search\r
54  and show mode\r
55 X-BeenThere: notmuch@notmuchmail.org\r
56 X-Mailman-Version: 2.1.12\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: Wed, 25 Nov 2009 05:24:12 -0000\r
68 \r
69 On Wed, 25 Nov 2009 10:28:00 +0530, "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> wrote:\r
70 > This add two faces, notmuch-show-subject-face and\r
71 > notmuch-tag-face. The first face is used to show the subject\r
72 > line in the notmuch-show-mode and the second one to show tags\r
73 > in the notmuch-search-mode.\r
74\r
75 First, I definetly think fontification is the way to go instead of\r
76 the adhoc/crappy way that cworth and I have been doing this in the\r
77 past.\r
78 \r
79 [snip]\r
80 \r
81 > +(defvar notmuch-show-font-lock-keywords\r
82 > +  (list ;; header in font-lock-type-face\r
83 > +   (list "\\(Subject:.*$\\)"\r
84 > +      '(1  'notmuch-show-subject-face)))\r
85 > +  "Additonal expression to hightlight in notmuch-show-mode")\r
86 > +\r
87 So what happens if I have Subject: xxxx in my message? We already ran\r
88 into a problem where a patch sent the list that included notmuch control\r
89 character caused it to go into an infinite loop, I'd prefer our\r
90 fontification code be a bit more resilient. At the very least this\r
91 should use the font-lock syntax tables stuff to only do header\r
92 fontification when inside the header block. This would probably require\r
93 that fontification occur before the message is post-processed by \r
94 notmuch-show to remove the section markers etc.\r
95 \r
96 Also +1 for more subduded colors than red. :) Possibly consider copying\r
97 the message-mode colors, so that there is a bit of consistency between\r
98 sending and viewing mail? Might even be able to steal the message-mode\r
99 faces by importing their symbols.\r
100 \r
101 [snip]\r
102 \r
103 >  (defun notmuch-search-mode ()\r
104 >    "Major mode for searching mail with notmuch.\r
105 > @@ -865,7 +888,18 @@ global search.\r
106 >    (setq truncate-lines t)\r
107 >    (setq major-mode 'notmuch-search-mode\r
108 >       mode-name "notmuch-search")\r
109 > -  (setq buffer-read-only t))\r
110 > +  (setq buffer-read-only t)\r
111 > +  (if (not notmuch-tag-face-alist)\r
112 > +      (add-to-list 'notmuch-search-font-lock-keywords (list\r
113 > +             "\\(([^)]*)$\\)" '(1  'notmuch-tag-face)))\r
114 This way of detecting the tags seems ok, but I think it would be nicer\r
115 if it could be done even more deterministically. :) One idea that be\r
116 neat is to have a --format=sexp for notmuch search, which exports sexps\r
117 (probably alists, but could be some other format) for the search results\r
118 that can just be eval'd and processed in a cleaner way (and would also\r
119 make for nicer APIs in emacs for querying notmuch itself). Actually I\r
120 really like the idea of a sexp output mode for show too, instead of the\r
121 markers.... *plots*\r
122 \r
123 > +    (progn\r
124 > +  (setq notmuch-search-tags (mapcar 'car notmuch-tag-face-alist))\r
125 > +  (loop for notmuch-search-tag  in notmuch-search-tags\r
126 > +    do (add-to-list 'notmuch-search-font-lock-keywords (list\r
127 > +                             (concat "\\(" notmuch-search-tag "\\)")\r
128 > +                 `(1  ,(cdr (assoc notmuch-search-tag notmuch-tag-face-alist))))))))\r
129 > +  (set (make-local-variable 'font-lock-defaults)\r
130 > +         '(notmuch-search-font-lock-keywords t)))\r
131 >  \r
132 I don't really see the point of fontifying all tags the same way if no\r
133 tag-faces have been set, especially if none of the rest of the search\r
134 results are fontified.\r
135 \r
136 Alex\r