comparison lisp/gnus/gnus-topic.el @ 18:d95e72db5c07 r19-15b92

Import from CVS: tag r19-15b92
author cvs
date Mon, 13 Aug 2007 08:49:43 +0200
parents 0293115a14e9
children 8fc7fe29b841
comparison
equal deleted inserted replaced
17:4579af9d8826 18:d95e72db5c07
92 92
93 ;;; Utility functions 93 ;;; Utility functions
94 94
95 (defun gnus-group-topic-name () 95 (defun gnus-group-topic-name ()
96 "The name of the topic on the current line." 96 "The name of the topic on the current line."
97 (let ((topic (get-text-property (point-at-bol) 'gnus-topic))) 97 (let ((topic (get-text-property (gnus-point-at-bol) 'gnus-topic)))
98 (and topic (symbol-name topic)))) 98 (and topic (symbol-name topic))))
99 99
100 (defun gnus-group-topic-level () 100 (defun gnus-group-topic-level ()
101 "The level of the topic on the current line." 101 "The level of the topic on the current line."
102 (get-text-property (point-at-bol) 'gnus-topic-level)) 102 (get-text-property (gnus-point-at-bol) 'gnus-topic-level))
103 103
104 (defun gnus-group-topic-unread () 104 (defun gnus-group-topic-unread ()
105 "The number of unread articles in topic on the current line." 105 "The number of unread articles in topic on the current line."
106 (get-text-property (point-at-bol) 'gnus-topic-unread)) 106 (get-text-property (gnus-point-at-bol) 'gnus-topic-unread))
107 107
108 (defun gnus-topic-unread (topic) 108 (defun gnus-topic-unread (topic)
109 "Return the number of unread articles in TOPIC." 109 "Return the number of unread articles in TOPIC."
110 (or (save-excursion 110 (or (save-excursion
111 (and (gnus-topic-goto-topic topic) 111 (and (gnus-topic-goto-topic topic)
116 "Return non-nil if the current line is a topic." 116 "Return non-nil if the current line is a topic."
117 (gnus-group-topic-name)) 117 (gnus-group-topic-name))
118 118
119 (defun gnus-topic-visible-p () 119 (defun gnus-topic-visible-p ()
120 "Return non-nil if the current topic is visible." 120 "Return non-nil if the current topic is visible."
121 (get-text-property (point-at-bol) 'gnus-topic-visible)) 121 (get-text-property (gnus-point-at-bol) 'gnus-topic-visible))
122 122
123 (defun gnus-topic-articles-in-topic (entries) 123 (defun gnus-topic-articles-in-topic (entries)
124 (let ((total 0) 124 (let ((total 0)
125 number) 125 number)
126 (while entries 126 (while entries
640 ;; Go through all living groups and make sure that 640 ;; Go through all living groups and make sure that
641 ;; they belong to some topic. 641 ;; they belong to some topic.
642 (let* ((tgroups (apply 'append (mapcar (lambda (entry) (cdr entry)) 642 (let* ((tgroups (apply 'append (mapcar (lambda (entry) (cdr entry))
643 gnus-topic-alist))) 643 gnus-topic-alist)))
644 (entry (assoc (caar gnus-topic-topology) gnus-topic-alist)) 644 (entry (assoc (caar gnus-topic-topology) gnus-topic-alist))
645 (newsrc gnus-newsrc-alist) 645 (newsrc (cdr gnus-newsrc-alist))
646 group) 646 group)
647 (while newsrc 647 (while newsrc
648 (unless (member (setq group (gnus-info-group (pop newsrc))) tgroups) 648 (unless (member (setq group (gnus-info-group (pop newsrc))) tgroups)
649 (setcdr entry (cons group (cdr entry)))))) 649 (setcdr entry (cons group (cdr entry))))))
650 ;; Go through all topics and make sure they contain only living groups. 650 ;; Go through all topics and make sure they contain only living groups.
1285 (let ((alist gnus-topic-alist)) 1285 (let ((alist gnus-topic-alist))
1286 (while alist 1286 (while alist
1287 ;; !!!Sometimes nil elements sneak into the alist, 1287 ;; !!!Sometimes nil elements sneak into the alist,
1288 ;; for some reason or other. 1288 ;; for some reason or other.
1289 (setcar alist (delq nil (car alist))) 1289 (setcar alist (delq nil (car alist)))
1290 (setcar alist (delete "dummy.group" (car alist)))
1290 (gnus-topic-sort-topic (pop alist) func reverse)))) 1291 (gnus-topic-sort-topic (pop alist) func reverse))))
1291 1292
1292 (defun gnus-topic-sort-topic (topic func reverse) 1293 (defun gnus-topic-sort-topic (topic func reverse)
1293 ;; Each topic only lists the name of the group, while 1294 ;; Each topic only lists the name of the group, while
1294 ;; the sort predicates expect group infos as inputs. 1295 ;; the sort predicates expect group infos as inputs.