Fix content decoding in gnus-read-ephemeral-bug-group
authorAndreas Schwab <schwab@linux-m68k.org>
Thu, 8 Jan 2015 03:28:47 +0000 (03:28 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Thu, 8 Jan 2015 03:28:47 +0000 (03:28 +0000)
* gnus-group.el (gnus-read-ephemeral-bug-group): Bind
coding-system-for-read and coding-system-for-write only around
with-temp-file, and make buffer unibyte.  Don't write temp file twice.

lisp/ChangeLog
lisp/gnus-group.el

index fdce2b8..7e6f112 100644 (file)
        * registry.el (cl-remf, cl-loop, cl-subseq):
        Alias to remf, loop, and subseq respectively for old Emacsen.
 
+2014-12-19  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * gnus-group.el (gnus-read-ephemeral-bug-group): Bind
+       coding-system-for-read and coding-system-for-write only around
+       with-temp-file, and make buffer unibyte.  Don't write temp file twice.
+
 2014-12-18  Paul Eggert  <eggert@cs.ucla.edu>
 
        * registry.el (registry-db): Set default slot later.
index 29c380f..8dd1d78 100644 (file)
@@ -2455,27 +2455,27 @@ the bug number, and browsing the URL must return mbox output."
     (setq ids (string-to-number ids)))
   (unless (listp ids)
     (setq ids (list ids)))
-  (let ((tmpfile (mm-make-temp-file "gnus-temp-group-"))
-       (coding-system-for-write 'binary)
-       (coding-system-for-read 'binary))
-    (with-temp-file tmpfile
-      (dolist (id ids)
-       (url-insert-file-contents (format mbox-url id)))
-      (goto-char (point-min))
-      ;; Add the debbugs address so that we can respond to reports easily.
-      (while (re-search-forward "^To: " nil t)
-       (end-of-line)
-       (insert (format ", %s@%s" (car ids)
-                       (gnus-replace-in-string
-                        (gnus-replace-in-string mbox-url "^http://" "")
-                        "/.*$" ""))))
-      (write-region (point-min) (point-max) tmpfile)
-      (gnus-group-read-ephemeral-group
-       (format "nndoc+ephemeral:bug#%s"
-              (mapconcat 'number-to-string ids ","))
-       `(nndoc ,tmpfile
-              (nndoc-article-type mbox))
-       nil window-conf))
+  (let ((tmpfile (mm-make-temp-file "gnus-temp-group-")))
+    (let ((coding-system-for-write 'binary)
+         (coding-system-for-read 'binary))
+      (with-temp-file tmpfile
+       (set-buffer-multibyte nil)
+       (dolist (id ids)
+         (url-insert-file-contents (format mbox-url id)))
+       (goto-char (point-min))
+       ;; Add the debbugs address so that we can respond to reports easily.
+       (while (re-search-forward "^To: " nil t)
+         (end-of-line)
+         (insert (format ", %s@%s" (car ids)
+                         (gnus-replace-in-string
+                          (gnus-replace-in-string mbox-url "^http://" "")
+                          "/.*$" ""))))))
+    (gnus-group-read-ephemeral-group
+     (format "nndoc+ephemeral:bug#%s"
+            (mapconcat 'number-to-string ids ","))
+     `(nndoc ,tmpfile
+            (nndoc-article-type mbox))
+     nil window-conf)
     (delete-file tmpfile)))
 
 (defun gnus-read-ephemeral-debian-bug-group (number)