From: yamaoka Date: Wed, 30 Jan 2002 22:51:23 +0000 (+0000) Subject: Synch with Oort Gnus. X-Git-Tag: t-gnus-6_15_6-01-quimby~91 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=31b717159626ccf92039f1aeef664b1df209f73a;p=elisp%2Fgnus.git- Synch with Oort Gnus. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4ec000a..93967f9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,44 @@ +2002-01-30 ShengHuo ZHU + + * 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 * gnus-art.el (gnus-article-wash-html-with-w3m): Add keymap diff --git a/lisp/gnus-agent.el b/lisp/gnus-agent.el index 9759317..ff878d0 100644 --- a/lisp/gnus-agent.el +++ b/lisp/gnus-agent.el @@ -1866,7 +1866,7 @@ The following commands are available: (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) diff --git a/lisp/gnus-cache.el b/lisp/gnus-cache.el index 680b4cf..a7fc19c 100644 --- a/lisp/gnus-cache.el +++ b/lisp/gnus-cache.el @@ -283,9 +283,7 @@ it's not cached." ;; 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 diff --git a/lisp/gnus-range.el b/lisp/gnus-range.el index 43aa8b2..14cc416 100644 --- a/lisp/gnus-range.el +++ b/lisp/gnus-range.el @@ -61,6 +61,43 @@ If RANGE is a single range, return (RANGE). Otherwise, return RANGE." (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 <." @@ -79,6 +116,7 @@ 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 @@ -87,6 +125,7 @@ Both lists have to be sorted over <." (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 <." @@ -102,7 +141,11 @@ 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)) @@ -120,6 +163,7 @@ LIST1 and LIST2 have to be sorted over <." (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 <." @@ -143,7 +187,8 @@ 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)) @@ -392,7 +437,9 @@ LIST is a sorted list." (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)) diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el index 4e11cbe..574a58a 100644 --- a/lisp/gnus-sum.el +++ b/lisp/gnus-sum.el @@ -4724,8 +4724,9 @@ If SELECT-ARTICLES, only select those articles from GROUP." (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) @@ -4738,9 +4739,7 @@ If SELECT-ARTICLES, only select those articles from GROUP." (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 @@ -4772,13 +4771,13 @@ If SELECT-ARTICLES, only select those articles from GROUP." 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)) @@ -4950,9 +4949,7 @@ If SELECT-ARTICLES, only select those articles from GROUP." ;; 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 @@ -5936,13 +5933,13 @@ displayed, no centering will be performed." (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 @@ -6019,7 +6016,7 @@ The prefix argument ALL means to select all articles." (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 '<)) @@ -7302,15 +7299,17 @@ fetched for this group." "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 @@ -11112,9 +11111,10 @@ returned." (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 @@ -11153,17 +11153,17 @@ If ALL is a number, fetch this number of articles." (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) @@ -11178,12 +11178,11 @@ If ALL is a number, fetch this number of articles." (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 () diff --git a/lisp/message.el b/lisp/message.el index 904c001..1ed6457 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -472,21 +472,13 @@ The provided functions are: :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" "-") "" "-") @@ -1040,6 +1032,14 @@ candidates: ;;; 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)) diff --git a/lisp/nnagent.el b/lisp/nnagent.el index a94a8fa..3597e7d 100644 --- a/lisp/nnagent.el +++ b/lisp/nnagent.el @@ -133,8 +133,8 @@ 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)) diff --git a/lisp/nnfolder.el b/lisp/nnfolder.el index 96c53bb..4974fd1 100644 --- a/lisp/nnfolder.el +++ b/lisp/nnfolder.el @@ -430,7 +430,7 @@ the group. Then the marks file will be regenerated properly by Gnus.") (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) diff --git a/lisp/nnheader.el b/lisp/nnheader.el index 4cf477a..52f7e9f 100644 --- a/lisp/nnheader.el +++ b/lisp/nnheader.el @@ -49,7 +49,8 @@ (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. diff --git a/lisp/nnsoup.el b/lisp/nnsoup.el index ba8c1ba..0836590 100644 --- a/lisp/nnsoup.el +++ b/lisp/nnsoup.el @@ -1,6 +1,6 @@ ;;; 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 @@ -338,7 +338,7 @@ backend for the messages.") (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)