+2002-01-30 ShengHuo ZHU <zsh@cs.rochester.edu>
+
+ * message.el (message-cite-prefix-regexp): Use text-mode-syntax-table.
+ (message-mode-syntax-table): Move back the previous position.
+
+ * nnagent.el (nnagent-retrieve-headers): Use gnus-sorted-difference.
+
+ * gnus-agent.el (gnus-agent-retrieve-headers): Use
+ gnus-sorted-difference.
+
+ * nnsoup.el (nnsoup-request-expire-articles): Use
+ gnus-sorted-difference.
+
+ * nnheader.el: Autoload gnus-sorted-difference.
+
+ * nnfolder.el (nnfolder-request-expire-articles): Use
+ gnus-sorted-difference.
+
+ * gnus-cache.el (gnus-cache-retrieve-headers): Use
+ gnus-sorted-difference.
+
+ * gnus-range.el: Autoload cookies.
+ (gnus-sorted-difference): New function.
+ (gnus-sorted-ndifference): New function.
+ (gnus-sorted-nintersection): Rename from
+ gnus-set-sorted-intersection.
+ (gnus-sorted-nunion): Rename from gnus-set-sorted-union.
+ (gnus-list-range-difference): Rename from
+ gnus-inverse-list-range-intersection.
+ (gnus-inverse-list-range-intersection): Use defalias.
+
+ * gnus-sum.el (gnus-select-newsgroup): Use gnus-sorted-difference,
+ gnus-sorted-ndifference, and gnus-sorted-nintersection.
+ (gnus-articles-to-read): Use gnus-sorted-difference.
+ (gnus-summary-limit-mark-excluded-as-read): Use
+ gnus-sorted-intersection and gnus-sorted-ndifference.
+ (gnus-list-of-read-articles): Use gnus-list-range-difference.
+ (gnus-summary-insert-articles): Use gnus-sorted-difference.
+
+ * gnus-sum.el (gnus-summary-update-info): Use gnus-sorted-union.
+
2002-01-30 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-art.el (gnus-article-wash-html-with-w3m): Add keymap
(forward-line 1))
(setq cached-articles (nreverse cached-articles))))
(if (setq uncached-articles
- (gnus-set-difference articles cached-articles))
+ (gnus-sorted-difference articles cached-articles))
(progn
(set-buffer nntp-server-buffer)
(erase-buffer)
;; the normal way.
(let ((gnus-use-cache nil))
(gnus-retrieve-headers articles group fetch-old))
- (let ((uncached-articles (gnus-sorted-intersection
- (gnus-sorted-complement articles cached)
- articles))
+ (let ((uncached-articles (gnus-sorted-difference articles cached))
(cache-file (gnus-cache-file-name group ".overview"))
type)
;; We first retrieve all the headers that we don't have in
(setq list2 (cdr list2)))
list1))
+;;;###autoload
+(defun gnus-sorted-difference (list1 list2)
+ "Return a list of elements of LIST1 that do not appear in LIST2.
+Both lists have to be sorted over <.
+The tail of LIST1 is not copied."
+ (let (out)
+ (while (and list1 list2)
+ (cond ((= (car list1) (car list2))
+ (setq list1 (cdr list1)
+ list2 (cdr list2)))
+ ((< (car list1) (car list2))
+ (setq out (cons (car list1) out))
+ (setq list1 (cdr list1)))
+ (t
+ (setq list2 (cdr list2)))))
+ (nconc (nreverse out) list1)))
+
+;;;###autoload
+(defun gnus-sorted-ndifference (list1 list2)
+ "Return a list of elements of LIST1 that do not appear in LIST2.
+Both lists have to be sorted over <.
+LIST1 is modified."
+ (let* ((top (cons nil list1))
+ (prev top))
+ (while (and list1 list2)
+ (cond ((= (car list1) (car list2))
+ (setcdr prev (cdr list1))
+ (setq list1 (cdr list1)
+ list2 (cdr list2)))
+ ((< (car list1) (car list2))
+ (setq prev list1
+ list1 (cdr list1)))
+ (t
+ (setq list2 (cdr list2)))))
+ (cdr top)))
+
+;;;###autoload
(defun gnus-sorted-complement (list1 list2)
"Return a list of elements that are in LIST1 or LIST2 but not both.
Both lists have to be sorted over <."
(setq list2 (cdr list2)))))
(nconc (nreverse out) (or list1 list2)))))
+;;;###autoload
(defun gnus-intersection (list1 list2)
(let ((result nil))
(while list2
(setq list2 (cdr list2)))
result))
+;;;###autoload
(defun gnus-sorted-intersection (list1 list2)
"Return intersection of LIST1 and LIST2.
LIST1 and LIST2 have to be sorted over <."
(setq list2 (cdr list2)))))
(nreverse out)))
-(defun gnus-set-sorted-intersection (list1 list2)
+;;;###autoload
+(defalias 'gnus-set-sorted-intersection 'gnus-sorted-nintersection)
+
+;;;###autoload
+(defun gnus-sorted-nintersection (list1 list2)
"Return intersection of LIST1 and LIST2 by modifying cdr pointers of LIST1.
LIST1 and LIST2 have to be sorted over <."
(let* ((top (cons nil list1))
(setcdr prev nil)
(cdr top)))
+;;;###autoload
(defun gnus-sorted-union (list1 list2)
"Return union of LIST1 and LIST2.
LIST1 and LIST2 have to be sorted over <."
list2 (cdr list2)))
(nreverse out)))
-(defun gnus-set-sorted-union (list1 list2)
+;;;###autoload
+(defun gnus-sorted-nunion (list1 list2)
"Return union of LIST1 and LIST2 by modifying cdr pointers of LIST1.
LIST1 and LIST2 have to be sorted over <."
(let* ((top (cons nil list1))
(push number result)))
(nreverse result)))
-(defun gnus-inverse-list-range-intersection (list ranges)
+(defalias 'gnus-inverse-list-range-intersection 'gnus-list-range-difference)
+
+(defun gnus-list-range-difference (list ranges)
"Return a list of numbers in LIST that are not members of RANGES.
LIST is a sorted list."
(setq ranges (gnus-range-normalize ranges))
(setq cached gnus-newsgroup-cached))
(setq gnus-newsgroup-unreads
- (gnus-set-difference
- (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
+ (gnus-sorted-ndifference
+ (gnus-sorted-ndifference gnus-newsgroup-unreads
+ gnus-newsgroup-marked)
gnus-newsgroup-dormant))
(setq gnus-newsgroup-processable nil)
(if (setq articles select-articles)
(setq gnus-newsgroup-unselected
- (gnus-sorted-intersection
- gnus-newsgroup-unreads
- (gnus-sorted-complement gnus-newsgroup-unreads articles)))
+ (gnus-sorted-difference gnus-newsgroup-unreads articles))
(setq articles (gnus-articles-to-read group read-all)))
(cond
gnus-newsgroup-headers))
(setq gnus-newsgroup-articles fetched-articles)
(setq gnus-newsgroup-unreads
- (gnus-set-sorted-intersection
+ (gnus-sorted-nintersection
gnus-newsgroup-unreads fetched-articles))
(gnus-compute-unseen-list)
;; Removed marked articles that do not exist.
(gnus-update-missing-marks
- (gnus-sorted-complement fetched-articles articles))
+ (gnus-sorted-difference articles fetched-articles))
;; We might want to build some more threads first.
(when (and gnus-fetch-old-headers
(eq gnus-headers-retrieved-by 'nov))
;; Select the N most recent articles.
(setq articles (nthcdr (- number select) articles))))
(setq gnus-newsgroup-unselected
- (gnus-sorted-intersection
- gnus-newsgroup-unreads
- (gnus-sorted-complement gnus-newsgroup-unreads articles)))
+ (gnus-sorted-difference gnus-newsgroup-unreads articles))
(when gnus-alter-articles-to-read-function
(setq gnus-newsgroup-unreads
(sort
(marked (gnus-info-marks info))
(active (gnus-active group)))
(and info active
- (gnus-set-difference
- (gnus-sorted-complement
- (gnus-uncompress-range active)
- (gnus-list-of-unread-articles group))
- (append
- (gnus-uncompress-range (cdr (assq 'dormant marked)))
- (gnus-uncompress-range (cdr (assq 'tick marked))))))))
+ (gnus-list-range-difference
+ (gnus-list-range-difference
+ (gnus-sorted-complement
+ (gnus-uncompress-range active)
+ (gnus-list-of-unread-articles group))
+ (cdr (assq 'dormant marked)))
+ (cdr (assq 'tick marked))))))
;; Various summary commands
(when gnus-newsgroup-kill-headers
(setq gnus-newsgroup-killed
(gnus-compress-sequence
- (nconc
+ (gnus-sorted-union
(gnus-list-range-intersection
(setq gnus-newsgroup-unselected
(sort gnus-newsgroup-unselected '<))
"Mark all unread excluded articles as read.
If ALL, mark even excluded ticked and dormants as read."
(interactive "P")
- (let ((articles (gnus-sorted-complement
+ (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
+ (let ((articles (gnus-sorted-ndifference
(sort
(mapcar (lambda (h) (mail-header-number h))
gnus-newsgroup-headers)
'<)
- (sort gnus-newsgroup-limit '<)))
+ gnus-newsgroup-limit))
article)
(setq gnus-newsgroup-unreads
- (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit))
+ (gnus-sorted-intersection gnus-newsgroup-unreads
+ gnus-newsgroup-limit))
(if all
(setq gnus-newsgroup-dormant nil
gnus-newsgroup-marked nil
(defun gnus-summary-insert-articles (articles)
(when (setq articles
- (gnus-set-difference articles
- (mapcar (lambda (h) (mail-header-number h))
- gnus-newsgroup-headers)))
+ (gnus-sorted-difference articles
+ (mapcar (lambda (h)
+ (mail-header-number h))
+ gnus-newsgroup-headers)))
(setq gnus-newsgroup-headers
(merge 'list
gnus-newsgroup-headers
(interactive "P")
(prog1
(let ((old (mapcar 'car gnus-newsgroup-data))
- (i (car gnus-newsgroup-active))
older len)
- (while (<= i (cdr gnus-newsgroup-active))
- (or (memq i old) (push i older))
- (incf i))
+ (setq older
+ (gnus-sorted-difference
+ (gnus-uncompress-range (list gnus-newsgroup-active))
+ old))
(setq len (length older))
(cond
((null older) nil)
((numberp all)
(if (< all len)
- (setq older (subseq older 0 all))))
+ (setq older (last older all))))
(all nil)
(t
(if (and (numberp gnus-large-newsgroup)
(unless (string-match "^[ \t]*$" input)
(setq all (string-to-number input))
(if (< all len)
- (setq older (subseq older 0 all))))))))
+ (setq older (last older all))))))))
(if (not older)
(message "No old news.")
- (let ((gnus-fetch-old-headers t))
- (gnus-summary-insert-articles older))
- (gnus-summary-limit (gnus-union older old))))
+ (gnus-summary-insert-articles older)
+ (gnus-summary-limit (gnus-sorted-union older old))))
(gnus-summary-position-point)))
(defun gnus-summary-insert-new-articles ()
:group 'message-insertion
:type 'regexp)
-(defvar message-mode-syntax-table
- (let ((table (copy-syntax-table text-mode-syntax-table)))
- (modify-syntax-entry ?% ". " table)
- (modify-syntax-entry ?> ". " table)
- (modify-syntax-entry ?< ". " table)
- table)
- "Syntax table used while in Message mode.")
-
(defcustom message-cite-prefix-regexp
(if (string-match "[[:digit:]]" "1") ;; support POSIX?
"\\([ \t]*[-_.[:word:]]+>+\\|[ \t]*[]>ยป|:}+]\\)+"
;; ?-, ?_ or ?. MUST NOT be in syntax entry w.
(let ((old-table (syntax-table))
non-word-constituents)
- (set-syntax-table message-mode-syntax-table)
+ (set-syntax-table text-mode-syntax-table)
(setq non-word-constituents
(concat
(if (string-match "\\w" "-") "" "-")
;;; Internal variables.
;;; Well, not really internal.
+(defvar message-mode-syntax-table
+ (let ((table (copy-syntax-table text-mode-syntax-table)))
+ (modify-syntax-entry ?% ". " table)
+ (modify-syntax-entry ?> ". " table)
+ (modify-syntax-entry ?< ". " table)
+ table)
+ "Syntax table used while in Message mode.")
+
(defface message-header-to-face
'((((class color)
(background dark))
arts n)
(save-excursion
(gnus-agent-load-alist group)
- (setq arts (gnus-set-difference articles
- (mapcar 'car gnus-agent-article-alist)))
+ (setq arts (gnus-sorted-difference
+ articles (mapcar 'car gnus-agent-article-alist)))
(set-buffer nntp-server-buffer)
(erase-buffer)
(nnheader-insert-nov-file file (car articles))
(nnfolder-save-buffer)
(nnfolder-adjust-min-active newsgroup)
(nnfolder-save-active nnfolder-group-alist nnfolder-active-file)
- (gnus-sorted-complement articles (nreverse deleted-articles)))))
+ (gnus-sorted-difference articles (nreverse deleted-articles)))))
(deffoo nnfolder-request-move-article (article group server
accept-form &optional last)
(eval-and-compile
(autoload 'gnus-sorted-intersection "gnus-range")
(autoload 'gnus-intersection "gnus-range")
- (autoload 'gnus-sorted-complement "gnus-range"))
+ (autoload 'gnus-sorted-complement "gnus-range")
+ (autoload 'gnus-sorted-difference "gnus-range"))
(defcustom gnus-verbose-backends 7
"Integer that says how verbose the Gnus backends should be.
;;; nnsoup.el --- SOUP access for Gnus
-;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001
+;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
;; Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
(delete-file (nnsoup-file prefix t)))
t)
(setcdr (cdr total-infolist) (delq info (cddr total-infolist)))
- (setq articles (gnus-sorted-complement articles range-list))))
+ (setq articles (gnus-sorted-difference articles range-list))))
(when (not mod-time)
(setcdr (cdr total-infolist) (delq info (cddr total-infolist)))))
(if (cddr total-infolist)