notmuch.el: controlling what does and doesn't get expanded in searches
[notmuch-archives.git] / 5f / 2725c38daa3937271926f872532cfa82adf125
1 Return-Path: <prvs=0024c1a73=jrosenthal@jhu.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 0B995431FB6\r
6         for <notmuch@notmuchmail.org>; Fri, 28 Jan 2011 12:25:35 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.3\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3] 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 3ZZTxGc8hlIW for <notmuch@notmuchmail.org>;\r
16         Fri, 28 Jan 2011 12:25:34 -0800 (PST)\r
17 Received: from ipex1.johnshopkins.edu (ipex1.johnshopkins.edu [162.129.8.141])\r
18         (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 4D20F431FB5\r
21         for <notmuch@notmuchmail.org>; Fri, 28 Jan 2011 12:25:34 -0800 (PST)\r
22 X-IronPort-Anti-Spam-Filtered: true\r
23 X-IronPort-Anti-Spam-Result: AvQEAJ+1Qk0KoSAO/2dsb2JhbACWZI8SsgyIaYVPBIUYhw8\r
24 X-IronPort-AV: E=Sophos;i="4.60,394,1291611600"; d="scan'208";a="43230333"\r
25 Received: from watt.hwcampus.jhu.edu ([10.161.32.14])\r
26         by ipex1.johnshopkins.edu with ESMTP/TLS/ADH-AES256-SHA;\r
27         28 Jan 2011 15:25:28 -0500\r
28 Received: by watt.hwcampus.jhu.edu (Postfix, from userid 502)\r
29         id 6711F789974; Fri, 28 Jan 2011 15:25:28 -0500 (EST)\r
30 From: Jesse Rosenthal <jrosenthal@jhu.edu>\r
31 To: notmuch@notmuchmail.org\r
32 Subject: A tool for printing from notmuch\r
33 User-Agent: Notmuch/0.5-56-g74cb76a (http://notmuchmail.org) Emacs/23.2.1\r
34         (x86_64-apple-darwin)\r
35 Date: Fri, 28 Jan 2011 15:25:28 -0500\r
36 Message-ID: <m162t87p3b.fsf@watt.hwcampus.jhu.edu>\r
37 MIME-Version: 1.0\r
38 Content-Type: text/plain; charset=us-ascii\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Fri, 28 Jan 2011 20:25:35 -0000\r
52 \r
53 Dear all,\r
54 \r
55 Printing from notmuch is a bit of a pain. Muttprint doesn't really help\r
56 much, because it can't handle multiparts well, doesn't know what to do\r
57 with html, and will print out pages of base64 if you have\r
58 attachments. And more often than not, what I need to print is an HTML\r
59 email (a bus ticket or something).\r
60 \r
61 A solution I've been working on for my own use is here:\r
62 \r
63 http://commonmeasure.org/~jkr/notmuchprint\r
64 \r
65 It's a python script that takes a message-id and sends printable html to\r
66 your browser or stdout. Plain text is put in <pre> tags, html mails are,\r
67 as much as possible, left alone, except for the headers at the top. You\r
68 can configure (in ~/.notmuchprintrc) the font for plain text emails,\r
69 what browser to use, whether to view automatically or output html, and\r
70 whether or not to prefer plain text if both are available. (Since it's\r
71 mainly html emails I need to print or view, I set the last one to no.)\r
72 It also has a few command line options. Type "--help" to get the scoop.\r
73 \r
74 The only requirement outside of the stdlib is BeautifulSoup, to deal\r
75 with email html.\r
76 \r
77 It's been working well for me. I have the following in my .emacs so I\r
78 can use it from show mode by pressing "z":\r
79 \r
80 (define-key notmuch-show-mode-map "z" \r
81   '(lambda () (interactive)\r
82      (shell-command (concat "notmuchprint '"\r
83                             (notmuch-show-get-message-id) \r
84                             "'"))))\r
85 \r
86 The single-quotes are necessary for msg-ids with dollar-signs and\r
87 whatnot in them.\r
88 \r
89 A couple of points:\r
90 \r
91 1. The HTML generation is intentionally pretty primitive. First, I\r
92 didn't want to spend too much time on what is just a header box. Second,\r
93 I didn't want to introduce any CSS that might screw with whatever\r
94 godawful styles the email has. I'd welcome someone fixing this part up,\r
95 but I still think a goal should be to make sure html emails remain\r
96 unchanged.\r
97 \r
98 2. It uses json instead of the python bindings for two reasons. First,\r
99 for my own personal use-case (remote) the bindings wouldn't have\r
100 helped. Second, I'm guessing that the slowdown from getting json output\r
101 is more than compensated for by having gmime do the parsing instead of\r
102 python.\r
103 \r
104 Anyway, if people find this useful, or want to make changes, I'll make a\r
105 git repo. For now, though, I just wanted to share it, since it's been\r
106 making my life a bit easier.\r
107 \r
108 Best,\r
109 Jesse\r