Re: [PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / 9c / c0f67353e662a637f0f438a3375e94434963f1
1 Return-Path: <tomi.ollila@iki.fi>\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 CA658431FBC\r
6         for <notmuch@notmuchmail.org>; Mon, 29 Oct 2012 09:31:43 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 Z8F+0eZ34C1w for <notmuch@notmuchmail.org>;\r
16         Mon, 29 Oct 2012 09:31:42 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 9B708431FAF\r
19         for <notmuch@notmuchmail.org>; Mon, 29 Oct 2012 09:31:42 -0700 (PDT)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id 1AD2610007D;\r
22         Mon, 29 Oct 2012 18:31:43 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Michael Stapelberg <michael+nm@stapelberg.de>, notmuch@notmuchmail.org\r
25 Subject: Re: [BUG] Saving attachments containing UTF-8 chars\r
26 In-Reply-To: <x6sj8xiexi.fsf@midna.zekjur.net>\r
27 References: <x6sj8xiexi.fsf@midna.zekjur.net>\r
28 User-Agent: Notmuch/0.14+59~gf9031cd (http://notmuchmail.org) Emacs/24.2.1\r
29         (x86_64-unknown-linux-gnu)\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
31         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
32         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
33 Date: Mon, 29 Oct 2012 18:31:42 +0200\r
34 Message-ID: <m2pq416xzl.fsf@guru.guru-group.fi>\r
35 MIME-Version: 1.0\r
36 Content-Type: text/plain; charset=utf-8\r
37 Content-Transfer-Encoding: quoted-printable\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.13\r
40 Precedence: list\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, 29 Oct 2012 16:31:44 -0000\r
51 \r
52 On Mon, Oct 29 2012, Michael Stapelberg wrote:\r
53 \r
54 > Hello,\r
55 >\r
56 > attached you can find a message which seems to trigger a bug somewhere\r
57 > in my notmuch setup. The message has been sent to me and includes a\r
58 > patchfile, which, when saved using the "w" key in notmuch-emacs, cannot\r
59 > be applied.\r
60 >\r
61 > When using munpack(1) on the raw mail file (I=E2=80=99ve attached rawmail=\r
62 .gz\r
63 > just to be sure that the message doesn=E2=80=99t get mangled in some way)=\r
64 , the\r
65 > unpacked attachment can be attached just fine.\r
66 >\r
67 > When diff'ing both files, I see that munpack correctly stores the file,\r
68 > including the problematic UTF-8 apostrophe:\r
69 > 00000200  67 3b 20 64 69 64 6e e2  80 99 74 20 72 65 61 64  |g; didn...t =\r
70 read|\r
71 >\r
72 > However, the version of the file saved with notmuch contains:\r
73 > 00000200  67 3b 20 64 69 64 6e 19  74 20 72 65 61 64 22 20  |g; didn.t re=\r
74 ad" |\r
75 >\r
76 > If there is anything I can do to help debugging this (or if there is a\r
77 > known fix), please let me know.\r
78 \r
79 I can verify this bug: I copied 'rawmail' to my mail store and attempted\r
80 to 'w' the attacment and got the same result (after notmuch new).\r
81 \r
82 The saving code first does\r
83 notmuch show --format=3Draw id:"508953E6.70006@gmail.com"\r
84 which decodes OK on command line, and to the buffer when=20\r
85 kill-buffer is outcommented in (with-current-notmuch-show-message ...)=20\r
86 macro.\r
87 \r
88 I attempted a set of trial-&-error tricks to get the attachment\r
89 saved "correctly", and at least this seems to do the trick:\r
90 \r
91 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
92 index f273eb4..a6a85c0 100644\r
93 --- a/emacs/notmuch-show.el\r
94 +++ b/emacs/notmuch-show.el\r
95 @@ -203,9 +203,11 @@ For example, if you wanted to remove an \"unread\" tag=\r
96  and add a\r
97       (let ((id (notmuch-show-get-message-id)))\r
98         (let ((buf (generate-new-buffer (concat "*notmuch-msg-" id "*"))))\r
99           (with-current-buffer buf\r
100 -           (call-process notmuch-command nil t nil "show" "--format=3Draw" id)\r
101 -           ,@body)\r
102 -        (kill-buffer buf)))))\r
103 +          (let ((coding-system-for-read 'no-conversion)\r
104 +                (coding-system-for-write 'no-conversion))\r
105 +            (call-process notmuch-command nil t nil "show" "--format=3Draw" id)\r
106 +            ,@body))))))\r
107 +%%      (kill-buffer buf)))))\r
108 =20\r
109  (defun notmuch-show-turn-on-visual-line-mode ()\r
110    "Enable Visual Line mode."\r
111 \r
112 ---\r
113 \r
114 (kill-buffer is outcommented above for testing purposes)\r
115 \r
116 To test this this needs to me evaluated and then the functions\r
117 using this macro (notmuch-show-save-attachments  in this case)\r
118 \r
119 Smart suggestions for proper fix ?\r
120 \r
121 Tomi\r