Re: [PATCH v4 09/16] index encrypted parts when asked.
[notmuch-archives.git] / 2e / 873c69b1075c4bf0ee25b255c20dc3c8c80d6f
1 Return-Path: <david@tethera.net>\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 932FE431FAF\r
6         for <notmuch@notmuchmail.org>; Sun, 22 Jun 2014 03:51:18 -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 JXedmo8NCxfm for <notmuch@notmuchmail.org>;\r
16         Sun, 22 Jun 2014 03:51:13 -0700 (PDT)\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
18         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id D43AE431FAE\r
21         for <notmuch@notmuchmail.org>; Sun, 22 Jun 2014 03:51:13 -0700 (PDT)\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
23         (envelope-from <david@tethera.net>)\r
24         id 1WyfMe-0005Fo-CV; Sun, 22 Jun 2014 07:51:12 -0300\r
25 Received: (nullmailer pid 29826 invoked by uid 1000); Sun, 22 Jun 2014\r
26         10:51:09 -0000\r
27 From: David Bremner <david@tethera.net>\r
28 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
29 Subject: Re: [PATCH] emacs/show: add command to view a patch using diff mode\r
30 In-Reply-To: <1355018749-12775-1-git-send-email-markwalters1009@gmail.com>\r
31 References: <1354992232-21791-1-git-send-email-david@tethera.net>\r
32         <1355018749-12775-1-git-send-email-markwalters1009@gmail.com>\r
33 User-Agent: Notmuch/0.18+13~g1adde01 (http://notmuchmail.org) Emacs/24.3.1\r
34         (x86_64-pc-linux-gnu)\r
35 Date: Sun, 22 Jun 2014 07:51:09 -0300\r
36 Message-ID: <87wqc9usiq.fsf@zancas.localnet>\r
37 MIME-Version: 1.0\r
38 Content-Type: text/plain\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: Sun, 22 Jun 2014 10:51:18 -0000\r
52 \r
53 Mark Walters <markwalters1009@gmail.com> writes:\r
54 \r
55 > From: markwalters1009@gmail.com\r
56 >\r
57 > This enables fast navigation between hunks and better highlighting.\r
58 >\r
59 > The use of notmuch-get-bodypart-internal could be improved; hard\r
60 > coding to 1 seems to work for the output of git-format-patch. It also\r
61 > not so nice to call (insert (notmuch-get-bodypart-internal ...)) since the\r
62 > last thing n-g-b-i does is call buffer-string.\r
63 >\r
64 > Author: David Bremner <bremner@debian.org>\r
65 \r
66 Recently I had cause to update this function to produce more\r
67 "git-format-patch" like output. I didn't yet merge with Mark's proposed\r
68 changes. Here it is in case anyone else finds this useful (I used it to\r
69 de-quoted-printable a patch).\r
70 \r
71 (defun notmuch-show-view-as-patch ()\r
72   "View the the current message as a patch."\r
73   (interactive)\r
74   (let* ((id (notmuch-show-get-message-id t))\r
75          (date (notmuch-show-get-date))\r
76          (from_ (concat "From " id " " date "\n"))\r
77          (from: (concat "From: " (notmuch-show-get-from) "\n"))\r
78          (date: (concat "Date: " date "\n"))\r
79          (subject (concat "Subject: " (notmuch-show-get-subject) "\n"))\r
80          (diff-default-read-only t)\r
81          (buf (get-buffer-create (concat "*notmuch-patch-" id "*"))))\r
82     (switch-to-buffer buf)\r
83     (let ((inhibit-read-only t))\r
84       (erase-buffer)\r
85       (insert from_)\r
86       (insert from:)\r
87       (insert date:)\r
88       (insert subject)\r
89       (insert "\n")\r
90       (insert (notmuch-get-bodypart-internal (concat "id:" id) 1 nil)))\r
91     (set-buffer-modified-p nil)\r
92     (diff-mode)\r
93     (goto-char (point-min))))\r