summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1996-02-20 19:17:30 +0000
committerKarl Heuer <kwzh@gnu.org>1996-02-20 19:17:30 +0000
commit0353f9e14423d7e9f6c3ec7d835def4fb38860c5 (patch)
treeed9407c3f01da07fd47818c403a85852bec1dc47
parent62c19f3145dc923eca2248fa6a991ce409255a82 (diff)
downloademacs-0353f9e14423d7e9f6c3ec7d835def4fb38860c5.tar.gz
(nnheader-insert-head): Make sure the entire head of
the article is inserted.
-rw-r--r--lisp/nnheader.el23
1 files changed, 16 insertions, 7 deletions
diff --git a/lisp/nnheader.el b/lisp/nnheader.el
index 95736be3f8d..671530620e1 100644
--- a/lisp/nnheader.el
+++ b/lisp/nnheader.el
@@ -188,14 +188,23 @@
(set (car (car state)) (nth 1 (car state)))
(setq state (cdr state))))
-;; Read the head of an article.
+(defvar nnheader-max-head-length 4096
+ "The maximum length of a HEAD.")
+
(defun nnheader-insert-head (file)
- (let ((beg 0)
- (chop 1024))
- (while (and (eq chop (nth 1 (nnheader-insert-file-contents-literally
- file nil beg (setq beg (+ chop beg)))))
- (prog1 (not (search-backward "\n\n" nil t))
- (goto-char (point-max)))))))
+ "Insert the head of the article."
+ (if (eq nnheader-max-head-length t)
+ ;; Just read the entire file.
+ (insert-file-contents-literally file)
+ ;; Read 1K blocks until we find a separator.
+ (let ((beg 0)
+ (chop 1024))
+ (while (and (eq chop (nth 1 (insert-file-contents-literally
+ file nil beg (setq beg (+ beg chop)))))
+ (prog1 (not (search-forward "\n\n" nil t))
+ (goto-char (point-max)))
+ (or (null nnheader-max-head-length)
+ (< beg nnheader-max-head-length)))))))
(defun nnheader-article-p ()
(goto-char (point-min))