--- /dev/null
+Return-Path: <david@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 932FE431FAF\r
+ for <notmuch@notmuchmail.org>; Sun, 22 Jun 2014 03:51:18 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id JXedmo8NCxfm for <notmuch@notmuchmail.org>;\r
+ Sun, 22 Jun 2014 03:51:13 -0700 (PDT)\r
+Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
+ (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id D43AE431FAE\r
+ for <notmuch@notmuchmail.org>; Sun, 22 Jun 2014 03:51:13 -0700 (PDT)\r
+Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
+ (envelope-from <david@tethera.net>)\r
+ id 1WyfMe-0005Fo-CV; Sun, 22 Jun 2014 07:51:12 -0300\r
+Received: (nullmailer pid 29826 invoked by uid 1000); Sun, 22 Jun 2014\r
+ 10:51:09 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs/show: add command to view a patch using diff mode\r
+In-Reply-To: <1355018749-12775-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1354992232-21791-1-git-send-email-david@tethera.net>\r
+ <1355018749-12775-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.18+13~g1adde01 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Sun, 22 Jun 2014 07:51:09 -0300\r
+Message-ID: <87wqc9usiq.fsf@zancas.localnet>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 22 Jun 2014 10:51:18 -0000\r
+\r
+Mark Walters <markwalters1009@gmail.com> writes:\r
+\r
+> From: markwalters1009@gmail.com\r
+>\r
+> This enables fast navigation between hunks and better highlighting.\r
+>\r
+> The use of notmuch-get-bodypart-internal could be improved; hard\r
+> coding to 1 seems to work for the output of git-format-patch. It also\r
+> not so nice to call (insert (notmuch-get-bodypart-internal ...)) since the\r
+> last thing n-g-b-i does is call buffer-string.\r
+>\r
+> Author: David Bremner <bremner@debian.org>\r
+\r
+Recently I had cause to update this function to produce more\r
+"git-format-patch" like output. I didn't yet merge with Mark's proposed\r
+changes. Here it is in case anyone else finds this useful (I used it to\r
+de-quoted-printable a patch).\r
+\r
+(defun notmuch-show-view-as-patch ()\r
+ "View the the current message as a patch."\r
+ (interactive)\r
+ (let* ((id (notmuch-show-get-message-id t))\r
+ (date (notmuch-show-get-date))\r
+ (from_ (concat "From " id " " date "\n"))\r
+ (from: (concat "From: " (notmuch-show-get-from) "\n"))\r
+ (date: (concat "Date: " date "\n"))\r
+ (subject (concat "Subject: " (notmuch-show-get-subject) "\n"))\r
+ (diff-default-read-only t)\r
+ (buf (get-buffer-create (concat "*notmuch-patch-" id "*"))))\r
+ (switch-to-buffer buf)\r
+ (let ((inhibit-read-only t))\r
+ (erase-buffer)\r
+ (insert from_)\r
+ (insert from:)\r
+ (insert date:)\r
+ (insert subject)\r
+ (insert "\n")\r
+ (insert (notmuch-get-bodypart-internal (concat "id:" id) 1 nil)))\r
+ (set-buffer-modified-p nil)\r
+ (diff-mode)\r
+ (goto-char (point-min))))\r