[PATCH 2/2] emacs: less guessing of character set in messages
authorTomi Ollila <tomi.ollila@iki.fi>
Sun, 18 Nov 2012 20:06:25 +0000 (22:06 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:50:43 +0000 (09:50 -0800)
6f/d4f40cb339e17d921cd64412bc00083a38f85e [new file with mode: 0644]

diff --git a/6f/d4f40cb339e17d921cd64412bc00083a38f85e b/6f/d4f40cb339e17d921cd64412bc00083a38f85e
new file mode 100644 (file)
index 0000000..1e8395b
--- /dev/null
@@ -0,0 +1,82 @@
+Return-Path: <too@guru-group.fi>\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 CE81B431FC2\r
+       for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 12:06:30 -0800 (PST)\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 I0UOfxgbIojp for <notmuch@notmuchmail.org>;\r
+       Sun, 18 Nov 2012 12:06:30 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id DBB62431FBD\r
+       for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 12:06:29 -0800 (PST)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+       id 81A1F10014D; Sun, 18 Nov 2012 22:06:28 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/2] emacs: less guessing of character set in messages\r
+Date: Sun, 18 Nov 2012 22:06:25 +0200\r
+Message-Id: <1353269185-23210-2-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.8.0\r
+In-Reply-To: <1353269185-23210-1-git-send-email-tomi.ollila@iki.fi>\r
+References: <id:87txsm23hs.fsf@betacantrips.com>\r
+       <1353269185-23210-1-git-send-email-tomi.ollila@iki.fi>\r
+Cc: tomi.ollila@iki.fi\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, 18 Nov 2012 20:06:31 -0000\r
+\r
+The macro with-current-notmuch-show-message executes command\r
+`notmuch show --format=raw id:...` which just outputs the contents\r
+of the mail file verbatim (into temporary buffer). In case e.g. utf-8\r
+locale is used the temporary buffer has buffer-file-coding-system as\r
+utf-8. In this case Emacs converts the data to multibyte format, guessing\r
+that input is in utf-8.\r
+However, the "raw" (MIME) message may contain octet data in any other\r
+8bit format, and as no (MIME-)content spesific handling to the message\r
+is done at this point, conversion to other formats may lose information.\r
+By setting coding-system-for-read 'no-conversion drops the conversion part\r
+and makes this handle input as notmuch-get-bodypart-internal() does.\r
+This marks the broken test in previous change fixed.\r
+---\r
+ emacs/notmuch-show.el | 7 ++++---\r
+ 1 file changed, 4 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 5b3e70e..44b6f35 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -203,9 +203,10 @@ For example, if you wanted to remove an \"unread\" tag and add a\r
+      (let ((id (notmuch-show-get-message-id)))\r
+        (let ((buf (generate-new-buffer (concat "*notmuch-msg-" id "*"))))\r
+          (with-current-buffer buf\r
+-          (call-process notmuch-command nil t nil "show" "--format=raw" id)\r
+-           ,@body)\r
+-       (kill-buffer buf)))))\r
++         (let ((coding-system-for-read 'no-conversion))\r
++           (call-process notmuch-command nil t nil "show" "--format=raw" id)\r
++           ,@body)\r
++         (kill-buffer buf))))))\r
\r
+ (defun notmuch-show-turn-on-visual-line-mode ()\r
+   "Enable Visual Line mode."\r
+-- \r
+1.8.0\r
+\r