(gnus-point-at-bol, gnus-point-at-eol): Remove.
[gnus] / lisp / gnus-cache.el
index ed2f79f..5f2195f 100644 (file)
@@ -1,5 +1,5 @@
 ;;; gnus-cache.el --- cache interface for Gnus
-;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
 ;;        Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -33,6 +33,8 @@
 (require 'gnus-range)
 (require 'gnus-start)
 (eval-when-compile
+  (if (not (fboundp 'gnus-agent-load-alist))
+      (defun gnus-agent-load-alist (group)))
   (require 'gnus-sum))
 
 (defcustom gnus-cache-active-file
@@ -179,7 +181,8 @@ it's not cached."
            (when (> (buffer-size) 0)
              (let ((coding-system-for-write gnus-cache-coding-system))
                (gnus-write-buffer file))
-             (setq headers (nnheader-parse-head t))
+             (nnheader-remove-body)
+             (setq headers (nnheader-parse-naked-head))
              (mail-header-set-number headers number)
              (gnus-cache-change-buffer group)
              (set-buffer (cdr gnus-cache-buffer))
@@ -330,14 +333,16 @@ Returns the list of articles entered."
          (when (gnus-cache-possibly-enter-article
                 gnus-newsgroup-name article
                 nil nil nil t)
+            (setq gnus-newsgroup-undownloaded (delq article gnus-newsgroup-undownloaded))
            (push article out))
        (gnus-message 2 "Can't cache article %d" article))
+      (gnus-summary-update-download-mark article)
       (gnus-summary-update-secondary-mark article))
     (gnus-summary-next-subject 1)
     (gnus-summary-position-point)
     (nreverse out)))
 
-(defun gnus-cache-remove-article (n)
+(defun gnus-cache-remove-article (&optional n)
   "Remove the next N articles from the cache.
 If not given a prefix, use the process marked articles instead.
 Returns the list of articles removed."
@@ -349,7 +354,14 @@ Returns the list of articles removed."
       (setq article (pop articles))
       (gnus-summary-remove-process-mark article)
       (when (gnus-cache-possibly-remove-article article nil nil nil t)
+        (when gnus-newsgroup-agentized
+          (let ((alist (gnus-agent-load-alist gnus-newsgroup-name)))
+            (unless (cdr (assoc article alist))
+              (setq gnus-newsgroup-undownloaded
+                    (gnus-add-to-sorted-list 
+                     gnus-newsgroup-undownloaded article)))))
        (push article out))
+      (gnus-summary-update-download-mark article)
       (gnus-summary-update-secondary-mark article))
     (gnus-summary-next-subject 1)
     (gnus-summary-position-point)
@@ -362,15 +374,10 @@ Returns the list of articles removed."
 (defun gnus-summary-insert-cached-articles ()
   "Insert all the articles cached for this group into the current buffer."
   (interactive)
-  (let ((cached gnus-newsgroup-cached)
-       (gnus-verbose (max 6 gnus-verbose)))
-    (if (not cached)
+  (let ((gnus-verbose (max 6 gnus-verbose)))
+    (if (not gnus-newsgroup-cached)
        (gnus-message 3 "No cached articles for this group")
-      (save-excursion
-       (while cached
-         (gnus-summary-goto-subject (pop cached) t)))
-      (gnus-summary-limit (append gnus-newsgroup-cached gnus-newsgroup-limit))
-      (gnus-summary-position-point))))
+      (gnus-summary-goto-subjects gnus-newsgroup-cached))))
 
 (defun gnus-summary-limit-include-cached ()
   "Limit the summary buffer to articles that are cached."
@@ -466,8 +473,7 @@ Returns the list of articles removed."
        (when (or (looking-at (concat (int-to-string number) "\t"))
                  (search-forward (concat "\n" (int-to-string number) "\t")
                                  (point-max) t))
-         (delete-region (progn (beginning-of-line) (point))
-                        (progn (forward-line 1) (point)))))
+         (gnus-delete-line)))
       (unless (setq gnus-newsgroup-cached
                    (delq article gnus-newsgroup-cached))
        (gnus-sethash gnus-newsgroup-name nil gnus-cache-active-hashtb)
@@ -518,7 +524,7 @@ Returns the list of articles removed."
       (set-buffer cache-buf)
       (if (search-forward (concat "\n" (int-to-string (car cached)) "\t")
                          nil t)
-         (setq beg (progn (beginning-of-line) (point))
+         (setq beg (point-at-bol)
                end (progn (end-of-line) (point)))
        (setq beg nil))
       (set-buffer nntp-server-buffer)
@@ -671,7 +677,7 @@ If LOW, update the lower bound instead."
       (gnus-message 5 "Generating the cache active file...")
       (setq gnus-cache-active-hashtb (gnus-make-hashtable 123)))
     (when (string-match "^\\(nn[^_]+\\)_" group)
-      (setq group (replace-match "\\1:" t t group)))
+      (setq group (replace-match "\\1:" t nil group)))
     ;; Separate articles from all other files and directories.
     (while files
       (if (string-match "^[0-9]+$" (file-name-nondirectory (car files)))