• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/gnus/

Lines Matching +defs:gnus +defs:list +defs:range +defs:difference

0 ;;; gnus-range.el --- range and sequence functions for Gnus
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
32 ;;; List and range functions
34 (defsubst gnus-range-normalize (range)
36 If RANGE is a single range, return (RANGE). Otherwise, return RANGE."
37 (if (listp (cdr-safe range)) range (list range)))
39 (defun gnus-last-element (list)
41 (while (cdr list)
42 (setq list (cdr list)))
43 (car list))
45 (defun gnus-copy-sequence (list)
46 "Do a complete, total copy of a list."
48 (while (consp list)
49 (if (consp (car list))
50 (push (gnus-copy-sequence (pop list)) out)
51 (push (pop list) out)))
52 (if list
53 (nconc (nreverse out) list)
56 (defun gnus-set-difference (list1 list2)
57 "Return a list of elements of LIST1 that do not appear in LIST2."
64 (defun gnus-range-difference (range1 range2)
65 "Return the range of elements in RANGE1 that do not appear in RANGE2.
67 (setq range1 (gnus-range-normalize range1))
68 (setq range2 (gnus-range-normalize range2))
69 (let* ((new-range (cons nil (copy-sequence range1)))
70 (r new-range)
81 ;; Invalid range: may result from overlap condition (below)
82 ;; remove Invalid range
101 (setcdr r (nconc (list (cons min1 (1- min2)) (cons (1+ max2) max1)) (cddr r)))))))
102 (cdr new-range)))
107 (defun gnus-sorted-difference (list1 list2)
108 "Return a list of elements of LIST1 that do not appear in LIST2.
124 (defun gnus-sorted-ndifference (list1 list2)
125 "Return a list of elements of LIST1 that do not appear in LIST2.
143 (defun gnus-sorted-complement (list1 list2)
144 "Return a list of elements that are in LIST1 or LIST2 but not both.
162 (defun gnus-intersection (list1 list2)
171 (defun gnus-sorted-intersection (list1 list2)
187 (defun gnus-sorted-range-intersection (range1 range2)
239 (defalias 'gnus-set-sorted-intersection 'gnus-sorted-nintersection)
242 (defun gnus-sorted-nintersection (list1 list2)
261 (defun gnus-sorted-union (list1 list2)
285 (defun gnus-sorted-nunion (list1 list2)
299 (setcdr prev (list (car list2)))
304 (setcdr prev (list (car list2)))
309 (defun gnus-compress-sequence (numbers &optional always-list)
310 "Convert list of numbers to a list of ranges or a single range.
311 If ALWAYS-LIST is non-nil, this function will always release a list of
332 (if (and (not always-list) (null result))
333 (if (= first last) (list first) (cons first last))
337 (defalias 'gnus-uncompress-sequence 'gnus-uncompress-range)
338 (defun gnus-uncompress-range (ranges)
339 "Expand a list of ranges into a list of numbers.
340 RANGES is either a single range on the form `(num . num)' or a list of
366 (defun gnus-add-to-range (ranges list)
367 "Return a list of ranges that has all articles from both RANGES and LIST.
370 (gnus-compress-sequence list t)
371 (setq list (copy-sequence list))
373 (setq ranges (list ranges)))
376 (while (and ranges list)
377 (setq ilist list)
380 (while (and list (cdr list) (< (cadr list) lowest))
381 (setq list (cdr list)))
383 (setq temp list)
384 (setq list (cdr list))
386 (setq out (nconc (gnus-compress-sequence ilist t) out)))
389 (while (and list (<= (car list) highest))
390 (setq list (cdr list)))
392 (when list
393 (setq out (nconc (gnus-compress-sequence list t) out)))
421 (defun gnus-remove-from-range (range1 range2)
422 "Return a range that has all articles from RANGE2 removed from RANGE1.
423 The returned range is always a list. RANGE2 can also be a unsorted
424 list of articles. RANGE1 is modified by side effects, RANGE2 is not
429 (range2 (gnus-copy-sequence range2)))
430 (setq range1 (if (listp (cdr range1)) range1 (list range1))
431 range2 (sort (if (listp (cdr range2)) range2 (list range2))
497 (defun gnus-member-of-range (number ranges)
515 (defun gnus-list-range-intersection (list ranges)
516 "Return a list of numbers in LIST that are members of RANGES.
517 LIST is a sorted list."
518 (setq ranges (gnus-range-normalize ranges))
520 (while (setq number (pop list))
534 (defalias 'gnus-inverse-list-range-intersection 'gnus-list-range-difference)
536 (defun gnus-list-range-difference (list ranges)
537 "Return a list of numbers in LIST that are not members of RANGES.
538 LIST is a sorted list."
539 (setq ranges (gnus-range-normalize ranges))
541 (while (setq number (pop list))
555 (defun gnus-range-length (range)
558 ((null range)
560 ((not (listp (cdr range)))
561 (- (cdr range) (car range) -1))
564 (dolist (x range sum)
568 (defun gnus-sublist-p (list sublist)
572 (unless (memq (pop sublist) list)
577 (defun gnus-range-add (range1 range2)
580 (setq range1 (list range1)))
582 (setq range2 (list range2)))
585 range item selector)
624 (if item (push item range))
629 (if item (push item range))
630 (reverse range)))
633 (defun gnus-add-to-sorted-list (list num)
635 (let* ((top (cons nil list))
637 (while (and list (< (car list) num))
638 (setq prev list
639 list (cdr list)))
640 (unless (eq (car list) num)
641 (setcdr prev (cons num list)))
644 (defun gnus-range-map (func range)
646 (setq range (gnus-range-normalize range))
647 (while range
648 (let ((span (pop range)))
657 (provide 'gnus-range)
660 ;;; gnus-range.el ends here