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 D11E7431FBC
\r
6 for <notmuch@notmuchmail.org>; Mon, 15 Feb 2010 06:16:42 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.514 tagged_above=-999 required=5
\r
12 tests=[AWL=-0.404, BAYES_05=-1.11] autolearn=ham
\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 O2iz14CxXeyz for <notmuch@notmuchmail.org>;
\r
16 Mon, 15 Feb 2010 06:16:42 -0800 (PST)
\r
17 Received: from mail-fx0-f224.google.com (mail-fx0-f224.google.com
\r
19 by olra.theworths.org (Postfix) with ESMTP id D29C4431FAE
\r
20 for <notmuch@notmuchmail.org>; Mon, 15 Feb 2010 06:16:41 -0800 (PST)
\r
21 Received: by fxm24 with SMTP id 24so5895697fxm.0
\r
22 for <notmuch@notmuchmail.org>; Mon, 15 Feb 2010 06:16:40 -0800 (PST)
\r
23 Received: by 10.87.36.4 with SMTP id o4mr8968925fgj.69.1266243400843;
\r
24 Mon, 15 Feb 2010 06:16:40 -0800 (PST)
\r
25 Received: from aw.hh.sledj.net (gmp-ea-fw-1b.sun.com [192.18.8.1])
\r
26 by mx.google.com with ESMTPS id d8sm13745674fga.13.2010.02.15.06.16.39
\r
27 (version=TLSv1/SSLv3 cipher=RC4-MD5);
\r
28 Mon, 15 Feb 2010 06:16:40 -0800 (PST)
\r
29 Received: by aw.hh.sledj.net (Postfix, from userid 1000)
\r
30 id 48CE43A09B; Mon, 15 Feb 2010 14:16:22 +0000 (GMT)
\r
31 To: notmuch@notmuchmail.org
\r
32 From: David Edmondson <dme@dme.org>
\r
33 Date: Mon, 15 Feb 2010 14:16:22 +0000
\r
34 Message-ID: <87zl3afutl.fsf@aw.hh.sledj.net>
\r
36 Content-Type: multipart/mixed; boundary="=-=-="
\r
37 Subject: [notmuch] [RFC] labelling parts
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.13
\r
41 List-Id: "Use and development of the notmuch mail system."
\r
42 <notmuch.notmuchmail.org>
\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
46 List-Post: <mailto:notmuch@notmuchmail.org>
\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
50 X-List-Received-Date: Mon, 15 Feb 2010 14:16:43 -0000
\r
54 I've always been quite fond of the way that gnus labelled parts in MIME
\r
55 messages. Here's a start at doing the same for notmuch.el. Is this
\r
56 something that might be accepted upstream if I continue?
\r
58 Obvious next steps are:
\r
59 - allow the user to choose which parts have buttons (i.e perhaps
\r
60 not text/plain by default),
\r
61 - have the inserted buttons actually do something useful (toggle
\r
62 visibility and/or save).
\r
66 Content-Type: text/x-diff
\r
67 Content-Disposition: inline;
\r
68 filename=0001-notmuch.el-Label-the-head-of-each-part.patch
\r
70 >From fcdbb8b3452911ce4c836547fc12519b1881e515 Mon Sep 17 00:00:00 2001
\r
71 From: David Edmondson <dme@dme.org>
\r
72 Date: Mon, 15 Feb 2010 14:13:45 +0000
\r
73 Subject: [PATCH] notmuch.el: Label the head of each part.
\r
76 notmuch.el | 25 ++++++++++++++++++-------
\r
77 1 files changed, 18 insertions(+), 7 deletions(-)
\r
79 diff --git a/notmuch.el b/notmuch.el
\r
80 index b4f8e12..ea74a72 100644
\r
83 @@ -128,6 +128,9 @@ remaining lines into a button.")
\r
84 (defvar notmuch-show-attachment-end-regexp "\fattachment}")
\r
85 (defvar notmuch-show-part-begin-regexp "\fpart{")
\r
86 (defvar notmuch-show-part-end-regexp "\fpart}")
\r
88 +(defvar notmuch-show-buttonize-begin-regexp "\f\\(part\\|attachment\\){")
\r
89 +(defvar notmuch-show-buttonize-end-regexp "\f\\(part\\|attachment\\)}")
\r
90 (defvar notmuch-show-marker-regexp "\f\\(message\\|header\\|body\\|attachment\\|part\\)[{}].*$")
\r
92 (defvar notmuch-show-id-regexp "\\(id:[^ ]*\\)")
\r
93 @@ -650,6 +653,9 @@ which this thread was originally shown."
\r
94 'help-echo "mouse-1, RET: Show message"
\r
95 'face 'notmuch-message-summary-face
\r
96 :supertype 'notmuch-button-invisibility-toggle-type)
\r
97 +(define-button-type 'notmuch-button-part-toggle-type 'help-echo "mouse-1, RET: Show part"
\r
98 + :supertype 'notmuch-button-invisibility-toggle-type
\r
99 + 'face 'font-lock-keyword-face)
\r
101 (defun notmuch-show-citation-regexp (depth)
\r
102 "Build a regexp for matching citations at a given DEPTH (indent)"
\r
103 @@ -731,7 +737,7 @@ is what to put on the button."
\r
106 (defun notmuch-show-markup-part (beg end depth)
\r
107 - (if (re-search-forward notmuch-show-part-begin-regexp nil t)
\r
108 + (if (re-search-forward notmuch-show-buttonize-begin-regexp nil t)
\r
110 (let (mime-message mime-type)
\r
112 @@ -739,14 +745,19 @@ is what to put on the button."
\r
113 (setq mime-type (car (split-string (buffer-substring
\r
114 (match-beginning 1) (match-end 1))))))
\r
118 + (insert-button (format (concat "%" (format "%d" depth) "s[ %s ]\n") "" mime-type)
\r
119 + :type 'notmuch-button-part-toggle-type)
\r
121 (if (equal mime-type "text/html")
\r
122 (let ((filename (notmuch-show-get-filename)))
\r
124 (insert-file-contents filename nil nil nil t)
\r
125 (setq mime-message (mm-dissect-buffer)))))
\r
128 (let ((beg (point-marker)))
\r
129 - (re-search-forward notmuch-show-part-end-regexp)
\r
130 + (re-search-forward notmuch-show-buttonize-end-regexp)
\r
131 (let ((end (copy-marker (match-beginning 0))))
\r
134 @@ -765,12 +776,12 @@ is what to put on the button."
\r
135 (if (equal mime-type "text/html")
\r
136 (mm-display-part mime-message))))
\r
138 - (notmuch-show-markup-citations-region beg end depth)
\r
139 + (if (equal mime-type "text/plain")
\r
140 + (notmuch-show-markup-citations-region beg end depth))
\r
141 ; Advance to the next part (if any) (so the outer loop can
\r
142 ; determine whether we've left the current message.
\r
143 - (if (re-search-forward notmuch-show-part-begin-regexp nil t)
\r
144 - (beginning-of-line)))))
\r
146 + (if (re-search-forward notmuch-show-buttonize-begin-regexp nil t)
\r
147 + (beginning-of-line))))))
\r
150 (defun notmuch-show-markup-parts-region (beg end depth)
\r
160 David Edmondson, http://dme.org
\r