From: Andreas Schwab Date: Fri, 19 Dec 2014 10:47:51 +0000 (+0100) Subject: Fix content decoding in gnus-read-ephemeral-bug-group X-Git-Tag: emacs-25.0.90~2605^2~33 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ad97127d9cd627f9c217738de81d88720a5c4c3a;p=emacs.git Fix content decoding in gnus-read-ephemeral-bug-group * 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. --- diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 73a0de76a1f..93117d31c99 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -10,6 +10,12 @@ * mm-decode.el (mm-shr): Bind `shr-width' to `fill-column' so that lines don't get overlong when responding. +2014-12-19 Andreas Schwab + + * 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 * registry.el (registry-db): Set default slot later. diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 29c380f8234..8dd1d78dd0b 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -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)