comparison lisp/gnus/nnvirtual.el @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents 0d8b17d428b5
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
1 ;;; nnvirtual.el --- virtual newsgroups access for Gnus 1 ;;; nnvirtual.el --- virtual newsgroups access for Gnus
2 ;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002 2
3 ;; Free Software Foundation, Inc. 3 ;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 ;; 2003, 2004, 2005 Free Software Foundation, Inc.
4 5
5 ;; Author: David Moore <dmoore@ucsd.edu> 6 ;; Author: David Moore <dmoore@ucsd.edu>
6 ;; Lars Magne Ingebrigtsen <larsi@gnus.org> 7 ;; Lars Magne Ingebrigtsen <larsi@gnus.org>
7 ;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> 8 ;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
8 ;; Keywords: news 9 ;; Keywords: news
9 10
10 ;; This file is part of GNU Emacs. 11 ;; This file is part of GNU Emacs.
11 12
12 ;; GNU Emacs is free software; you can redistribute it and/or modify 13 ;; GNU Emacs is free software; you can redistribute it and/or modify
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details. 21 ;; GNU General Public License for more details.
21 22
22 ;; You should have received a copy of the GNU General Public License 23 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 ;; Boston, MA 02111-1307, USA. 26 ;; Boston, MA 02110-1301, USA.
26 27
27 ;;; Commentary: 28 ;;; Commentary:
28 29
29 ;; The other access methods (nntp, nnspool, etc) are general news 30 ;; The other access methods (nntp, nnspool, etc) are general news
30 ;; access methods. This module relies on Gnus and can not be used 31 ;; access methods. This module relies on Gnus and can not be used
43 (eval-when-compile (require 'cl)) 44 (eval-when-compile (require 'cl))
44 45
45 (nnoo-declare nnvirtual) 46 (nnoo-declare nnvirtual)
46 47
47 (defvoo nnvirtual-always-rescan t 48 (defvoo nnvirtual-always-rescan t
48 "*If non-nil, always scan groups for unread articles when entering a group. 49 "If non-nil, always scan groups for unread articles when entering a group.
49 If this variable is nil and you read articles in a component group 50 If this variable is nil and you read articles in a component group
50 after the virtual group has been activated, the read articles from the 51 after the virtual group has been activated, the read articles from the
51 component group will show up when you enter the virtual group.") 52 component group will show up when you enter the virtual group.")
52 53
53 (defvoo nnvirtual-component-regexp nil 54 (defvoo nnvirtual-component-regexp nil
54 "*Regexp to match component groups.") 55 "Regexp to match component groups.")
55 56
56 (defvoo nnvirtual-component-groups nil 57 (defvoo nnvirtual-component-groups nil
57 "Component group in this nnvirtual group.") 58 "Component group in this nnvirtual group.")
58 59
59 60
372 (setq unexpired (nconc unexpired 373 (setq unexpired (nconc unexpired
373 (mapcar 374 (mapcar
374 #'(lambda (article) 375 #'(lambda (article)
375 (nnvirtual-reverse-map-article 376 (nnvirtual-reverse-map-article
376 group article)) 377 group article))
377 (gnus-group-expire-articles-1 group))))) 378 (gnus-uncompress-range
378 (sort unexpired '<))) 379 (gnus-group-expire-articles-1 group))))))
380 (sort (delq nil unexpired) '<)))
379 381
380 382
381 ;;; Internal functions. 383 ;;; Internal functions.
382 384
383 (defun nnvirtual-convert-headers () 385 (defun nnvirtual-convert-headers ()
423 (goto-char (point-min)) 425 (goto-char (point-min))
424 (when (re-search-forward 426 (when (re-search-forward
425 (concat (regexp-quote (gnus-group-real-name group)) ":[0-9]+") 427 (concat (regexp-quote (gnus-group-real-name group)) ":[0-9]+")
426 nil t) 428 nil t)
427 (replace-match "" t t)) 429 (replace-match "" t t))
428 (unless (= (point) (point-max)) 430 (unless (eobp)
429 (insert " ") 431 (insert " ")
430 (when (not (string= "" prefix)) 432 (when (not (string= "" prefix))
431 (while (re-search-forward "[^ ]+:[0-9]+" nil t) 433 (while (re-search-forward "[^ ]+:[0-9]+" nil t)
432 (save-excursion 434 (save-excursion
433 (goto-char (match-beginning 0)) 435 (goto-char (match-beginning 0))
518 (car lists) 520 (car lists)
519 (sort (apply 'nconc lists) '<))) 521 (sort (apply 'nconc lists) '<)))
520 522
521 523
522 ;;; We map between virtual articles and real articles in a manner 524 ;;; We map between virtual articles and real articles in a manner
523 ;;; which keeps the size of the virtual active list the same as 525 ;;; which keeps the size of the virtual active list the same as the
524 ;;; the sum of the component active lists. 526 ;;; sum of the component active lists.
525 ;;; To achieve fair mixing of the groups, the last article in 527
526 ;;; each of N component groups will be in the last N articles 528 ;;; To achieve fair mixing of the groups, the last article in each of
527 ;;; in the virtual group. 529 ;;; N component groups will be in the last N articles in the virtual
528 530 ;;; group.
529 ;;; If you have 3 components A, B and C, with articles 1-8, 1-5, and 6-7 531
530 ;;; respectively, then the virtual article numbers look like: 532 ;;; If you have 3 components A, B and C, with articles 1-8, 1-5, and
533 ;;; 6-7 respectively, then the virtual article numbers look like:
531 ;;; 534 ;;;
532 ;;; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 535 ;;; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
533 ;;; A1 A2 A3 A4 B1 A5 B2 A6 B3 A7 B4 C6 A8 B5 C7 536 ;;; A1 A2 A3 A4 B1 A5 B2 A6 B3 A7 B4 C6 A8 B5 C7
534 537
535 ;;; To compute these mappings we generate a couple tables and then 538 ;;; To compute these mappings we generate a couple tables and then
814 (setq nnvirtual-info-installed nil) 817 (setq nnvirtual-info-installed nil)
815 )) 818 ))
816 819
817 (provide 'nnvirtual) 820 (provide 'nnvirtual)
818 821
822 ;;; arch-tag: ca8c8ad9-1bd8-4b0f-9722-90dc645a45f5
819 ;;; nnvirtual.el ends here 823 ;;; nnvirtual.el ends here