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