diff lisp/gnus/nnheader.el @ 72203:eddf5f0ed3c9

Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 121-122) - Update from CVS 2006-07-28 Reiner Steib <Reiner.Steib@gmx.de> * etc/GNUS-NEWS: Regenerate from Oort Gnus node in texi/gnus.texi using texi/gnus-news.el of the trunk. 2006-07-28 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/nnheader.el (nnheader-insert-head): Make it work with Mac as well. 2006-07-27 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/nnheader.el (nnheader-insert-head): Make it work even if the file uses CRLF for the line-break code. 2006-07-28 Katsumi Yamaoka <yamaoka@jpl.org> * man/gnus.texi (Oort Gnus): Mention that the Lisp files are now installed in .../site-lisp/gnus/ by default. [ From gnus-news.texi in the trunk. ] 2006-07-27 Reiner Steib <Reiner.Steib@gmx.de> * man/gnus.texi (MIME Commands): Additions for yEnc. Revision: emacs@sv.gnu.org/emacs--devo--0--patch-375
author Miles Bader <miles@gnu.org>
date Mon, 31 Jul 2006 09:40:13 +0000
parents 1077b8039c32
children 4fa1b5c6a34c 858cb33ae39d
line wrap: on
line diff
--- a/lisp/gnus/nnheader.el	Mon Jul 31 06:57:28 2006 +0000
+++ b/lisp/gnus/nnheader.el	Mon Jul 31 09:40:13 2006 +0000
@@ -586,17 +586,27 @@
     (if (eq nnheader-max-head-length t)
 	;; Just read the entire file.
 	(nnheader-insert-file-contents file)
-      ;; Read 1K blocks until we find a separator.
+      ;; Read blocks of the size specified by `nnheader-head-chop-length'
+      ;; until we find a separator.
       (let ((beg 0)
-	    format-alist)
+	    (start (point))
+	    ;; Use `binary' to prevent the contents from being decoded,
+	    ;; or it will change the number of characters that
+	    ;; `insert-file-contents' returns.
+	    (coding-system-for-read 'binary))
 	(while (and (eq nnheader-head-chop-length
-			(nth 1 (nnheader-insert-file-contents
+			(nth 1 (mm-insert-file-contents
 				file nil beg
 				(incf beg nnheader-head-chop-length))))
-		    (prog1 (not (search-forward "\n\n" nil t))
+		    ;; CRLF of CR might be used for the line-break code.
+		    (prog1 (not (re-search-forward "\n\r?\n\\|\r\r" nil t))
 		      (goto-char (point-max)))
 		    (or (null nnheader-max-head-length)
-			(< beg nnheader-max-head-length))))))
+			(< beg nnheader-max-head-length))))
+	;; Finally decode the contents.
+	(when (mm-coding-system-p nnheader-file-coding-system)
+	  (mm-decode-coding-region start (point-max)
+				   nnheader-file-coding-system))))
     t))
 
 (defun nnheader-article-p ()