Mercurial > hg > xemacs-beta
comparison lisp/gnus/gnus-cache.el @ 153:25f70ba0133c r20-3b3
Import from CVS: tag r20-3b3
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:38:25 +0200 |
parents | 585fb297b004 |
children | 43dd3413c7c7 |
comparison
equal
deleted
inserted
replaced
152:4c132ee2d62b | 153:25f70ba0133c |
---|---|
253 (insert-file-contents file) | 253 (insert-file-contents file) |
254 t))) | 254 t))) |
255 | 255 |
256 (defun gnus-cache-possibly-alter-active (group active) | 256 (defun gnus-cache-possibly-alter-active (group active) |
257 "Alter the ACTIVE info for GROUP to reflect the articles in the cache." | 257 "Alter the ACTIVE info for GROUP to reflect the articles in the cache." |
258 (when (equal group "no.norsk") (error "hie")) | |
259 (when gnus-cache-active-hashtb | 258 (when gnus-cache-active-hashtb |
260 (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb))) | 259 (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb))) |
261 (and cache-active | 260 (when cache-active |
262 (< (car cache-active) (car active)) | 261 (when (< (car cache-active) (car active)) |
263 (setcar active (car cache-active))) | 262 (setcar active (car cache-active))) |
264 (and cache-active | 263 (when (> (cdr cache-active) (cdr active)) |
265 (> (cdr cache-active) (cdr active)) | 264 (setcdr active (cdr cache-active))))))) |
266 (setcdr active (cdr cache-active)))))) | |
267 | 265 |
268 (defun gnus-cache-retrieve-headers (articles group &optional fetch-old) | 266 (defun gnus-cache-retrieve-headers (articles group &optional fetch-old) |
269 "Retrieve the headers for ARTICLES in GROUP." | 267 "Retrieve the headers for ARTICLES in GROUP." |
270 (let ((cached | 268 (let ((cached |
271 (setq gnus-newsgroup-cached (gnus-cache-articles-in-group group)))) | 269 (setq gnus-newsgroup-cached (gnus-cache-articles-in-group group)))) |
450 (gnus-summary-update-secondary-mark article) | 448 (gnus-summary-update-secondary-mark article) |
451 t))) | 449 t))) |
452 | 450 |
453 (defun gnus-cache-articles-in-group (group) | 451 (defun gnus-cache-articles-in-group (group) |
454 "Return a sorted list of cached articles in GROUP." | 452 "Return a sorted list of cached articles in GROUP." |
455 (let ((dir (file-name-directory (gnus-cache-file-name group 1)))) | 453 (let ((dir (file-name-directory (gnus-cache-file-name group 1))) |
454 articles) | |
456 (when (file-exists-p dir) | 455 (when (file-exists-p dir) |
457 (sort (mapcar (lambda (name) (string-to-int name)) | 456 (setq articles |
458 (directory-files dir nil "^[0-9]+$" t)) | 457 (sort (mapcar (lambda (name) (string-to-int name)) |
459 '<)))) | 458 (directory-files dir nil "^[0-9]+$" t)) |
459 '<)) | |
460 ;; Update the cache active file, just to synch more. | |
461 (when articles | |
462 (gnus-cache-update-active group (car articles) t) | |
463 (gnus-cache-update-active group (car (last articles)))) | |
464 articles))) | |
460 | 465 |
461 (defun gnus-cache-braid-nov (group cached) | 466 (defun gnus-cache-braid-nov (group cached) |
462 (let ((cache-buf (get-buffer-create " *gnus-cache*")) | 467 (let ((cache-buf (get-buffer-create " *gnus-cache*")) |
463 beg end) | 468 beg end) |
464 (gnus-cache-save-buffers) | 469 (gnus-cache-save-buffers) |
551 (kill-buffer (current-buffer))))))) | 556 (kill-buffer (current-buffer))))))) |
552 | 557 |
553 (defun gnus-cache-read-active (&optional force) | 558 (defun gnus-cache-read-active (&optional force) |
554 "Read the cache active file." | 559 "Read the cache active file." |
555 (gnus-make-directory gnus-cache-directory) | 560 (gnus-make-directory gnus-cache-directory) |
556 (if (not (and (file-exists-p gnus-cache-active-file) | 561 (if (or (not (file-exists-p gnus-cache-active-file)) |
557 (or force (not gnus-cache-active-hashtb)))) | 562 force) |
558 ;; There is no active file, so we generate one. | 563 ;; There is no active file, so we generate one. |
559 (gnus-cache-generate-active) | 564 (gnus-cache-generate-active) |
560 ;; We simply read the active file. | 565 ;; We simply read the active file. |
561 (save-excursion | 566 (save-excursion |
562 (gnus-set-work-buffer) | 567 (gnus-set-work-buffer) |