Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / 32 / 93c67cd2911d174b23607cacd68a3511f37d21
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 DE82E429E27\r
6         for <notmuch@notmuchmail.org>; Mon,  9 May 2011 16:33:42 -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.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 k7jIhv53t02P for <notmuch@notmuchmail.org>;\r
17         Mon,  9 May 2011 16:33:42 -0700 (PDT)\r
18 Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com\r
19         [209.85.161.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 2B106429E26\r
22         for <notmuch@notmuchmail.org>; Mon,  9 May 2011 16:33:42 -0700 (PDT)\r
23 Received: by fxm8 with SMTP id 8so4263410fxm.26\r
24         for <notmuch@notmuchmail.org>; Mon, 09 May 2011 16:33:40 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer;\r
27         bh=fzzVZabOMKX5mtFsBTSdyT3M/FZL0durHepC4ocdVxQ=;\r
28         b=BXPyIeeH0DQZ1cEnMpT2W7ZIiFrezhwNUC5MHc/1K3ktH4JYlscefhsFKArOqNpEI2\r
29         fDzbe+FPV93my5hdLHQDHBVhuuOT4utFO7O2IaReta5DZtsXX2jDOgemwlHhZ9G+pbKb\r
30         sfOuu+Rf/vXHd9q0GmPWTy4EAHW8kgYKo8aYc=\r
31 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
32         h=from:to:cc:subject:date:message-id:x-mailer;\r
33         b=Kk2WbcddxRP7Y6uM1LSc6zNcEYSXd7ABbZP5Wq2PnjBhbf9aGXxZqIN4BR302pcWov\r
34         R0XW2+pYt4bsdqh7FybkWawb/rxLK381Joqcg/S/Y2yOqFWp3ZkjGmjsrxggymsrMemE\r
35         aIkLETiOp6t1jX5sPhPdZpoYx/Sf1syMGLalM=\r
36 Received: by 10.223.161.194 with SMTP id s2mr765801fax.143.1304984020532;\r
37         Mon, 09 May 2011 16:33:40 -0700 (PDT)\r
38 Received: from localhost ([91.144.186.21])\r
39         by mx.google.com with ESMTPS id c24sm2166421fak.7.2011.05.09.16.33.38\r
40         (version=TLSv1/SSLv3 cipher=OTHER);\r
41         Mon, 09 May 2011 16:33:39 -0700 (PDT)\r
42 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
43 To: Notmuch Mail <notmuch@notmuchmail.org>\r
44 Subject: [PATCH] Don't re-compress .gz & al. in notmuch-show-save-part.\r
45 Date: Tue, 10 May 2011 03:33:55 +0400\r
46 Message-Id: <1304984035-20743-1-git-send-email-dmitry.kurochkin@gmail.com>\r
47 X-Mailer: git-send-email 1.7.5.1\r
48 X-BeenThere: notmuch@notmuchmail.org\r
49 X-Mailman-Version: 2.1.13\r
50 Precedence: list\r
51 List-Id: "Use and development of the notmuch mail system."\r
52         <notmuch.notmuchmail.org>\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
56 List-Post: <mailto:notmuch@notmuchmail.org>\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
60 X-List-Received-Date: Mon, 09 May 2011 23:33:43 -0000\r
61 \r
62 Write-region handles some file names specially, see Emacs Lisp\r
63 manual section 25.11 Making Certain File Names "Magic" [1].  This\r
64 is a nice feature for normal text editing, but it is not\r
65 desirable if we need to save raw file content (e.g. attachment).\r
66 In particular, this affects archives and may result in corrupted\r
67 attachments saved with notmuch-show-save-part (attachment button\r
68 click handler).\r
69 \r
70 Turns out, smart GNUS folks encountered the same problem and\r
71 implemented write-region wrapper which inhibits some file name\r
72 handlers.  In particular, this wrapper is used in mm-save-part,\r
73 which is why notmuch-save-attachments that uses it works fine\r
74 with archives.\r
75 \r
76 The patch replaces write-region with mm-write-region in\r
77 notmuch-show-save-part.  Also it removes coding-system-for-write\r
78 and require-final-newline setting in notmuch-show-save-part.  The\r
79 former is set in mm-write-region.  The latter seems to be\r
80 unneeded because mm-save-part does not use it.\r
81 \r
82 [1] http://www.gnu.org/s/emacs/manual/html_node/elisp/Magic-File-Names.html\r
83 ---\r
84 \r
85 This patch is for the release-candidate/0.6 branch.  I know\r
86 Jameson has declared it ready for release, but perhaps it is not\r
87 too late for a small fix?\r
88 \r
89 Adding a test for this would be nice, but is a low priority for\r
90 me.  If anyone volunteers, that would be welcomed :)\r
91 \r
92 Regards,\r
93   Dmitry\r
94 \r
95 \r
96  emacs/notmuch-show.el |    9 +++++----\r
97  1 files changed, 5 insertions(+), 4 deletions(-)\r
98 \r
99 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
100 index 825988c..23291ce 100644\r
101 --- a/emacs/notmuch-show.el\r
102 +++ b/emacs/notmuch-show.el\r
103 @@ -306,10 +306,11 @@ message at DEPTH in the current thread."\r
104                    "Filename to save as: "\r
105                    (or mailcap-download-directory "~/")\r
106                    nil nil\r
107 -                  filename))\r
108 -           (require-final-newline nil)\r
109 -           (coding-system-for-write 'no-conversion))\r
110 -       (write-region (point-min) (point-max) file)))))\r
111 +                  filename)))\r
112 +       ;; Don't re-compress .gz & al.  Arguably we should make\r
113 +       ;; `file-name-handler-alist' nil, but that would chop\r
114 +       ;; ange-ftp, which is reasonable to use here.\r
115 +       (mm-write-region (point-min) (point-max) file nil nil nil 'no-conversion t)))))\r
116  \r
117  (defun notmuch-show-mm-display-part-inline (msg part content-type content)\r
118    "Use the mm-decode/mm-view functions to display a part in the\r
119 -- \r
120 1.7.5.1\r
121 \r