]> git.cworth.org Git - obsolete/notmuch-old/commitdiff
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)
committerDavid Bremner <bremner@debian.org>
Tue, 27 Nov 2012 02:06:41 +0000 (22:06 -0400)
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
test/emacs

index 24db4c70aac6ebb9c4b73a5f12dd74e784bf8058..489e32c8bcafc1a9a3ef467ff45c8f098884f83d 100644 (file)
@@ -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."
index e01a6ff49b5c229d398f2ad2ed647c59bddf5319..4e941bbd43c3becae5d3febf84d83dea9ed19866 100755 (executable)
@@ -517,7 +517,6 @@ test_emacs '(let ((standard-input "\"attachment2.gz\""))
 test_expect_equal_file attachment2.gz "$EXPECTED/attachment"
 
 test_begin_subtest "Save 8bit attachment from within emacs using notmuch-show-save-attachments"
-test_subtest_known_broken
 
 add_message '[subject]="Attachment with 8bit chars"' \
        '[header]="MIME-Version: 1.0"' \