Re: [PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / 42 / dd02eb528ed0a90e1ce42b8f742c48b112b802
1 Return-Path: <dmitry.kurochkin@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 F359E429E21\r
6         for <notmuch@notmuchmail.org>; Fri, 25 Nov 2011 17:45:02 -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: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 yNeQ70-8ltn5 for <notmuch@notmuchmail.org>;\r
17         Fri, 25 Nov 2011 17:45:02 -0800 (PST)\r
18 Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com\r
19         [209.85.214.53]) (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 45697429E28\r
22         for <notmuch@notmuchmail.org>; Fri, 25 Nov 2011 17:45:02 -0800 (PST)\r
23 Received: by mail-bw0-f53.google.com with SMTP id q10so5540957bka.26\r
24         for <notmuch@notmuchmail.org>; Fri, 25 Nov 2011 17:45:01 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:subject:date:message-id:x-mailer:in-reply-to:references;\r
27         bh=ewOt/+AhuGQm8xYWcbTXmyNDRSbORxp4ZP8GYTBR5Zc=;\r
28         b=fZLKeJcjqO1GiLfhZ1BhA1oyipr7mLF2HoS6ilmCqYrHYNFia0y30AALGE5V8KyYhc\r
29         r2uRIRbXMTU2HLuqFDsU7hLpzNg5VTwqENSI+WRswRNJctFSb/0vcKXcJ4eBiFV3/oPU\r
30         mgZXP61OqWiimtEHwGDJeROwAg936nM8IF+IE=\r
31 Received: by 10.204.149.215 with SMTP id u23mr36948466bkv.105.1322271901868;\r
32         Fri, 25 Nov 2011 17:45:01 -0800 (PST)\r
33 Received: from localhost ([91.144.186.21])\r
34         by mx.google.com with ESMTPS id c4sm20377806bkk.13.2011.11.25.17.45.00\r
35         (version=TLSv1/SSLv3 cipher=OTHER);\r
36         Fri, 25 Nov 2011 17:45:01 -0800 (PST)\r
37 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH 3/3] emacs: do not call notmuch show for non-inlinable parts\r
40 Date: Sat, 26 Nov 2011 05:44:38 +0400\r
41 Message-Id: <1322271878-32614-3-git-send-email-dmitry.kurochkin@gmail.com>\r
42 X-Mailer: git-send-email 1.7.7.3\r
43 In-Reply-To: <1322271878-32614-1-git-send-email-dmitry.kurochkin@gmail.com>\r
44 References: <1322271878-32614-1-git-send-email-dmitry.kurochkin@gmail.com>\r
45 X-BeenThere: notmuch@notmuchmail.org\r
46 X-Mailman-Version: 2.1.13\r
47 Precedence: list\r
48 List-Id: "Use and development of the notmuch mail system."\r
49         <notmuch.notmuchmail.org>\r
50 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
52 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
53 List-Post: <mailto:notmuch@notmuchmail.org>\r
54 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
55 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
57 X-List-Received-Date: Sat, 26 Nov 2011 01:45:03 -0000\r
58 \r
59 Before the change, there was a workaround to avoid notmuch show calls\r
60 for parts with application/* Content-Type.  But non-inlinable parts\r
61 are not limited to this Content-Type (e.g. mp3 files have audio/mpeg\r
62 Content-Type and are not inlinable).  For such parts\r
63 `notmuch-show-insert-part-*/*' handler is called which unconditionally\r
64 fetches contents for all parts.\r
65 \r
66 The patch moves content fetching from `notmuch-show-insert-part-*/*'\r
67 to `notmuch-show-mm-display-part-inline' function after MIME inlinable\r
68 checks are done to avoid useless notmuch show calls.  The\r
69 application/* hack is no longer needed and removed.\r
70 ---\r
71  emacs/notmuch-show.el |   17 +++++------------\r
72  test/emacs            |    1 -\r
73  2 files changed, 5 insertions(+), 13 deletions(-)\r
74 \r
75 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
76 index 7be88f8..2b0820e 100644\r
77 --- a/emacs/notmuch-show.el\r
78 +++ b/emacs/notmuch-show.el\r
79 @@ -310,17 +310,17 @@ message at DEPTH in the current thread."\r
80         ;; ange-ftp, which is reasonable to use here.\r
81         (mm-write-region (point-min) (point-max) file nil nil nil 'no-conversion t)))))\r
82  \r
83 -(defun notmuch-show-mm-display-part-inline (msg part content-type content)\r
84 +(defun notmuch-show-mm-display-part-inline (msg part nth content-type)\r
85    "Use the mm-decode/mm-view functions to display a part in the\r
86  current buffer, if possible."\r
87    (let ((display-buffer (current-buffer)))\r
88      (with-temp-buffer\r
89 -      (insert content)\r
90        (let ((handle (mm-make-handle (current-buffer) (list content-type))))\r
91 -       (set-buffer display-buffer)\r
92         (if (and (mm-inlinable-p handle)\r
93                  (mm-inlined-p handle))\r
94 -           (progn\r
95 +           (let ((content (notmuch-show-get-bodypart-content msg part nth)))\r
96 +             (insert content)\r
97 +             (set-buffer display-buffer)\r
98               (mm-display-part handle)\r
99               t)\r
100           nil)))))\r
101 @@ -578,17 +578,10 @@ current buffer, if possible."\r
102                 nil))\r
103           nil))))\r
104  \r
105 -(defun notmuch-show-insert-part-application/* (msg part content-type nth depth declared-type\r
106 -)\r
107 -  ;; do not render random "application" parts\r
108 -  (notmuch-show-insert-part-header nth content-type declared-type (plist-get part :filename)))\r
109 -\r
110  (defun notmuch-show-insert-part-*/* (msg part content-type nth depth declared-type)\r
111    ;; This handler _must_ succeed - it is the handler of last resort.\r
112    (notmuch-show-insert-part-header nth content-type declared-type (plist-get part :filename))\r
113 -  (let ((content (notmuch-show-get-bodypart-content msg part nth)))\r
114 -    (if content\r
115 -       (notmuch-show-mm-display-part-inline msg part content-type content)))\r
116 +  (notmuch-show-mm-display-part-inline msg part nth content-type)\r
117    t)\r
118  \r
119  ;; Functions for determining how to handle MIME parts.\r
120 diff --git a/test/emacs b/test/emacs\r
121 index 38efe26..e2b438b 100755\r
122 --- a/test/emacs\r
123 +++ b/test/emacs\r
124 @@ -467,7 +467,6 @@ test_emacs "(let ((notmuch-command \"$notmuch_counter\"))\r
125  test_expect_equal $(notmuch_counter) 1\r
126  \r
127  test_begin_subtest "Do not call notmuch for non-inlinable audio/mpeg parts"\r
128 -test_subtest_known_broken\r
129  id='message-with-audio/mpeg-attachment@notmuchmail.org'\r
130  emacs_deliver_message \\r
131      'Message with audio/mpeg attachment' \\r
132 -- \r
133 1.7.7.3\r
134 \r