comparison lisp/gnus/nnsoup.el @ 85712:a3c27999decb

Update Gnus to No Gnus 0.7 from the Gnus CVS trunk Revision: emacs@sv.gnu.org/emacs--devo--0--patch-911
author Miles Bader <miles@gnu.org>
date Sun, 28 Oct 2007 09:18:39 +0000
parents 24202b793a08
children 107ccd98fa12 880960b70474
comparison
equal deleted inserted replaced
85711:b6f5dc84b2e1 85712:a3c27999decb
369 (not (atom (caadar nnsoup-group-alist)))) 369 (not (atom (caadar nnsoup-group-alist))))
370 (let ((alist nnsoup-group-alist) 370 (let ((alist nnsoup-group-alist)
371 entry e min max) 371 entry e min max)
372 (while (setq e (cdr (setq entry (pop alist)))) 372 (while (setq e (cdr (setq entry (pop alist))))
373 (setq min (caaar e)) 373 (setq min (caaar e))
374 (while (cdr e) 374 (setq max (cdar (car (last e))))
375 (setq e (cdr e)))
376 (setq max (cdar (car e)))
377 (setcdr entry (cons (cons min max) (cdr entry))))) 375 (setcdr entry (cons (cons min max) (cdr entry)))))
378 (setq nnsoup-group-alist-touched t)) 376 (setq nnsoup-group-alist-touched t))
379 nnsoup-group-alist)) 377 nnsoup-group-alist))
380 378
381 (defun nnsoup-write-active-file (&optional force) 379 (defun nnsoup-write-active-file (&optional force)
556 (nnsoup-index-buffer prefix 'msg)) 554 (nnsoup-index-buffer prefix 'msg))
557 555
558 (defun nnsoup-unpack-packets () 556 (defun nnsoup-unpack-packets ()
559 "Unpack all packets in `nnsoup-packet-directory'." 557 "Unpack all packets in `nnsoup-packet-directory'."
560 (let ((packets (directory-files 558 (let ((packets (directory-files
561 nnsoup-packet-directory t nnsoup-packet-regexp)) 559 nnsoup-packet-directory t nnsoup-packet-regexp)))
562 packet) 560 (dolist (packet packets)
563 (while (setq packet (pop packets))
564 (nnheader-message 5 "nnsoup: unpacking %s..." packet) 561 (nnheader-message 5 "nnsoup: unpacking %s..." packet)
565 (if (not (gnus-soup-unpack-packet 562 (if (not (gnus-soup-unpack-packet
566 nnsoup-tmp-directory nnsoup-unpacker packet)) 563 nnsoup-tmp-directory nnsoup-unpacker packet))
567 (nnheader-message 5 "Couldn't unpack %s" packet) 564 (nnheader-message 5 "Couldn't unpack %s" packet)
568 (delete-file packet) 565 (delete-file packet)
757 (string-to-number (match-string 1 f1))) 754 (string-to-number (match-string 1 f1)))
758 (progn (string-match "/\\([0-9]+\\)\\." f2) 755 (progn (string-match "/\\([0-9]+\\)\\." f2)
759 (string-to-number (match-string 1 f2))))))) 756 (string-to-number (match-string 1 f2)))))))
760 active group lines ident elem min) 757 active group lines ident elem min)
761 (set-buffer (get-buffer-create " *nnsoup work*")) 758 (set-buffer (get-buffer-create " *nnsoup work*"))
762 (while files 759 (dolist (file files)
763 (nnheader-message 5 "Doing %s..." (car files)) 760 (nnheader-message 5 "Doing %s..." file)
764 (erase-buffer) 761 (erase-buffer)
765 (nnheader-insert-file-contents (car files)) 762 (nnheader-insert-file-contents file)
766 (goto-char (point-min)) 763 (goto-char (point-min))
767 (if (not (re-search-forward "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t *\\(Xref: \\)? *[^ ]* \\([^ ]+\\):[0-9]" nil t)) 764 (if (not (re-search-forward "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t *\\(Xref: \\)? *[^ ]* \\([^ ]+\\):[0-9]" nil t))
768 (setq group "unknown") 765 (setq group "unknown")
769 (setq group (match-string 2))) 766 (setq group (match-string 2)))
770 (setq lines (count-lines (point-min) (point-max))) 767 (setq lines (count-lines (point-min) (point-max)))
771 (setq ident (progn (string-match 768 (setq ident (progn (string-match
772 "/\\([0-9]+\\)\\." (car files)) 769 "/\\([0-9]+\\)\\." file)
773 (substring 770 (match-string 1 file)))
774 (car files) (match-beginning 1)
775 (match-end 1))))
776 (if (not (setq elem (assoc group active))) 771 (if (not (setq elem (assoc group active)))
777 (push (list group (cons 1 lines) 772 (push (list group (cons 1 lines)
778 (list (cons 1 lines) 773 (list (cons 1 lines)
779 (vector ident group "ucm" "" lines))) 774 (vector ident group "ucm" "" lines)))
780 active) 775 active)
781 (nconc elem 776 (nconc elem
782 (list 777 (list
783 (list (cons (1+ (setq min (cdadr elem))) 778 (list (cons (1+ (setq min (cdadr elem)))
784 (+ min lines)) 779 (+ min lines))
785 (vector ident group "ucm" "" lines)))) 780 (vector ident group "ucm" "" lines))))
786 (setcdr (cadr elem) (+ min lines))) 781 (setcdr (cadr elem) (+ min lines))))
787 (setq files (cdr files)))
788 (nnheader-message 5 "") 782 (nnheader-message 5 "")
789 (setq nnsoup-group-alist active) 783 (setq nnsoup-group-alist active)
790 (nnsoup-write-active-file t))) 784 (nnsoup-write-active-file t)))
791 785
792 (defun nnsoup-delete-unreferenced-message-files () 786 (defun nnsoup-delete-unreferenced-message-files ()
799 (gnus-soup-area-prefix (cadr area))) 793 (gnus-soup-area-prefix (cadr area)))
800 (cddr ga))) 794 (cddr ga)))
801 nnsoup-group-alist))) 795 nnsoup-group-alist)))
802 (regexp "\\.MSG$\\|\\.IDX$") 796 (regexp "\\.MSG$\\|\\.IDX$")
803 (files (directory-files nnsoup-directory nil regexp)) 797 (files (directory-files nnsoup-directory nil regexp))
804 non-files file) 798 non-files)
805 ;; Find all files that aren't known by nnsoup. 799 ;; Find all files that aren't known by nnsoup.
806 (while (setq file (pop files)) 800 (dolist (file files)
807 (string-match regexp file) 801 (string-match regexp file)
808 (unless (member (substring file 0 (match-beginning 0)) known) 802 (unless (member (substring file 0 (match-beginning 0)) known)
809 (push file non-files))) 803 (push file non-files)))
810 ;; Sort and delete the files. 804 ;; Sort and delete the files.
811 (setq non-files (sort non-files 'string<)) 805 (setq non-files (sort non-files 'string<))