mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Move the Gnus range functions to a new range.el file
* lisp/emacs-lisp/range.el: New file. * lisp/gnus/gnus-agent.el (range): (gnus-agent-synchronize-group-flags): (gnus-agent-possibly-alter-active): (gnus-agent-fetch-headers): (gnus-agent-read-agentview): (gnus-agent-fetch-group-1): (gnus-agent-read-p): (gnus-agent-expire-group-1): (gnus-agent-retrieve-headers): Adjust callers. * lisp/gnus/gnus-art.el (range): (gnus-article-describe-bindings): * lisp/gnus/gnus-cloud.el (range): (gnus-cloud-available-chunks): * lisp/gnus/gnus-draft.el (gnus-group-send-queue): * lisp/gnus/gnus-group.el (range): (gnus-group-line-format-alist): (gnus-number-of-unseen-articles-in-group): (gnus-group-update-eval-form): (gnus-group-read-group): (gnus-group-delete-articles): (gnus-group-catchup): (gnus-group-expire-articles-1): (gnus-add-marked-articles): * lisp/gnus/gnus-int.el (gnus-request-marks): * lisp/gnus/gnus-kill.el (gnus-apply-kill-file-internal): * lisp/gnus/gnus-range.el (gnus-range-difference) (gnus-sorted-range-intersection, gnus-uncompress-range) (gnus-add-to-range, gnus-remove-from-range) (gnus-member-of-range, gnus-list-range-intersection) (gnus-list-range-difference, gnus-range-length, gnus-range-add) (gnus-range-map): Make into obsolete aliases. * lisp/gnus/gnus-start.el (gnus-make-articles-unread): (gnus-convert-old-ticks): (gnus-read-old-newsrc-el-file): * lisp/gnus/gnus-sum.el (gnus-select-newsgroup): (gnus-articles-to-read): (gnus-articles-to-read): (gnus-killed-articles): (gnus-adjust-marked-articles): (gnus-update-marks): (gnus-update-marks): (gnus-compute-read-articles): (gnus-list-of-read-articles): (gnus-summary-update-info): (gnus-summary-move-article): (gnus-summary-expire-articles): (gnus-update-read-articles): (gnus-summary-insert-old-articles): (gnus-summary-insert-old-articles): (gnus-summary-insert-old-articles): * lisp/gnus/mail-source.el (gnus-range): (gnus-compress-sequence): * lisp/gnus/nnheader.el (range): (gnus-range-add): (nnheader-update-marks-actions): * lisp/gnus/nnimap.el (nnimap-update-info): (nnimap-update-info): (nnimap-update-info): (nnimap-update-qresync-info): (nnimap-update-qresync-info): (nnimap-update-qresync-info): (nnimap-parse-copied-articles): * lisp/gnus/nnmaildir.el (nnmaildir-request-update-info): (nnmaildir-request-update-info): (nnmaildir-request-expire-articles): (nnmaildir-request-expire-articles): (nnmaildir-request-set-mark): * lisp/gnus/nnmairix.el (nnmairix-request-set-mark): * lisp/gnus/nnmbox.el (nnmbox-record-active-article): (nnmbox-record-deleted-article): * lisp/gnus/nnml.el (nnml-request-compact-group): * lisp/gnus/nnvirtual.el (nnvirtual-request-expire-articles): * lisp/gnus/nnselect.el (numbers-by-group): (nnselect-request-update-info): (nnselect-push-info):
This commit is contained in:
parent
ab17e35325
commit
39d4e1ca21
21 changed files with 705 additions and 562 deletions
|
|
@ -31,6 +31,7 @@
|
|||
(require 'gnus-srvr)
|
||||
(require 'gnus-util)
|
||||
(require 'timer)
|
||||
(require 'range)
|
||||
(eval-when-compile (require 'cl-lib))
|
||||
|
||||
(autoload 'gnus-server-update-server "gnus-srvr")
|
||||
|
|
@ -1219,8 +1220,8 @@ This can be added to `gnus-select-article-hook' or
|
|||
(cond ((eq mark 'read)
|
||||
(setf (gnus-info-read info)
|
||||
(funcall (if (eq what 'add)
|
||||
#'gnus-range-add
|
||||
#'gnus-remove-from-range)
|
||||
#'range-concat
|
||||
#'range-remove)
|
||||
(gnus-info-read info)
|
||||
range))
|
||||
(gnus-get-unread-articles-in-group
|
||||
|
|
@ -1233,8 +1234,8 @@ This can be added to `gnus-select-article-hook' or
|
|||
(gnus-info-marks info)))
|
||||
(setcdr info-marks
|
||||
(funcall (if (eq what 'add)
|
||||
#'gnus-range-add
|
||||
#'gnus-remove-from-range)
|
||||
#'range-concat
|
||||
#'range-remove)
|
||||
(cdr info-marks)
|
||||
range))))))))
|
||||
|
||||
|
|
@ -1307,7 +1308,7 @@ downloaded into the agent."
|
|||
|
||||
(let ((read (gnus-info-read info)))
|
||||
(setf (gnus-info-read info)
|
||||
(gnus-range-add
|
||||
(range-concat
|
||||
read
|
||||
(list (cons (1+ agent-max)
|
||||
(1- active-min))))))
|
||||
|
|
@ -1796,13 +1797,13 @@ article numbers will be returned."
|
|||
(articles (if fetch-all
|
||||
(if gnus-newsgroup-maximum-articles
|
||||
(let ((active (gnus-active group)))
|
||||
(gnus-uncompress-range
|
||||
(range-uncompress
|
||||
(cons (max (car active)
|
||||
(- (cdr active)
|
||||
gnus-newsgroup-maximum-articles
|
||||
-1))
|
||||
(cdr active))))
|
||||
(gnus-uncompress-range (gnus-active group)))
|
||||
(range-uncompress (gnus-active group)))
|
||||
(gnus-list-of-unread-articles group)))
|
||||
(gnus-decode-encoded-word-function 'identity)
|
||||
(gnus-decode-encoded-address-function 'identity)
|
||||
|
|
@ -1817,7 +1818,7 @@ article numbers will be returned."
|
|||
;; because otherwise the agent will remove their marks.)
|
||||
(dolist (arts (gnus-info-marks (gnus-get-info group)))
|
||||
(unless (memq (car arts) '(seen recent killed cache))
|
||||
(setq articles (gnus-range-add articles (cdr arts)))))
|
||||
(setq articles (range-concat articles (cdr arts)))))
|
||||
(setq articles (sort (gnus-uncompress-sequence articles) #'<)))
|
||||
|
||||
;; At this point, I have the list of articles to consider for
|
||||
|
|
@ -1851,15 +1852,15 @@ article numbers will be returned."
|
|||
;; gnus-agent-article-alist) equals (cdr (gnus-active
|
||||
;; group))}. The addition of one(the 1+ above) then
|
||||
;; forces Low to be greater than High. When this happens,
|
||||
;; gnus-list-range-intersection returns nil which
|
||||
;; range-list-intersection returns nil which
|
||||
;; indicates that no headers need to be fetched. -- Kevin
|
||||
(setq articles (gnus-list-range-intersection
|
||||
(setq articles (range-list-intersection
|
||||
articles (list (cons low high)))))))
|
||||
|
||||
(when articles
|
||||
(gnus-message
|
||||
10 "gnus-agent-fetch-headers: undownloaded articles are `%s'"
|
||||
(gnus-compress-sequence articles t)))
|
||||
(range-compress-list articles)))
|
||||
|
||||
(with-current-buffer nntp-server-buffer
|
||||
(if articles
|
||||
|
|
@ -2060,7 +2061,7 @@ doesn't exist, to valid the overview buffer."
|
|||
(let (state sequence uncomp)
|
||||
(while alist
|
||||
(setq state (caar alist)
|
||||
sequence (inline (gnus-uncompress-range (cdar alist)))
|
||||
sequence (inline (range-uncompress (cdar alist)))
|
||||
alist (cdr alist))
|
||||
(while sequence
|
||||
(push (cons (pop sequence) state) uncomp)))
|
||||
|
|
@ -2404,7 +2405,7 @@ contents, they are first saved to their own file."
|
|||
(let ((arts (cdr (assq mark (gnus-info-marks
|
||||
(setq info (gnus-get-info group)))))))
|
||||
(when arts
|
||||
(setq marked-articles (nconc (gnus-uncompress-range arts)
|
||||
(setq marked-articles (nconc (range-uncompress arts)
|
||||
marked-articles))
|
||||
))))
|
||||
(setq marked-articles (sort marked-articles #'<))
|
||||
|
|
@ -2544,7 +2545,7 @@ contents, they are first saved to their own file."
|
|||
(let ((read (gnus-info-read
|
||||
(or info (setq info (gnus-get-info group))))))
|
||||
(setf (gnus-info-read info)
|
||||
(gnus-add-to-range read unfetched-articles)))
|
||||
(range-add-list read unfetched-articles)))
|
||||
|
||||
(gnus-group-update-group group t)
|
||||
(sit-for 0)
|
||||
|
|
@ -2898,8 +2899,8 @@ The following commands are available:
|
|||
|
||||
(defun gnus-agent-read-p ()
|
||||
"Say whether an article is read or not."
|
||||
(gnus-member-of-range (mail-header-number gnus-headers)
|
||||
(gnus-info-read (gnus-get-info gnus-newsgroup-name))))
|
||||
(range-member-p (mail-header-number gnus-headers)
|
||||
(gnus-info-read (gnus-get-info gnus-newsgroup-name))))
|
||||
|
||||
(defun gnus-category-make-function (predicate)
|
||||
"Make a function from PREDICATE."
|
||||
|
|
@ -3115,7 +3116,7 @@ FORCE is equivalent to setting the expiration predicates to true."
|
|||
;; All articles EXCEPT those named by the caller
|
||||
;; are protected from expiration
|
||||
(gnus-sorted-difference
|
||||
(gnus-uncompress-range
|
||||
(range-uncompress
|
||||
(cons (caar alist)
|
||||
(caar (last alist))))
|
||||
(sort articles #'<)))))
|
||||
|
|
@ -3137,9 +3138,9 @@ FORCE is equivalent to setting the expiration predicates to true."
|
|||
;; Ticked and/or dormant articles are excluded
|
||||
;; from expiration
|
||||
(nconc
|
||||
(gnus-uncompress-range
|
||||
(range-uncompress
|
||||
(cdr (assq 'tick (gnus-info-marks info))))
|
||||
(gnus-uncompress-range
|
||||
(range-uncompress
|
||||
(cdr (assq 'dormant
|
||||
(gnus-info-marks info))))))))
|
||||
(nov-file (concat dir ".overview"))
|
||||
|
|
@ -3638,7 +3639,7 @@ has been fetched."
|
|||
(file-name-directory file) t))
|
||||
|
||||
(when fetch-old
|
||||
(setq articles (gnus-uncompress-range
|
||||
(setq articles (range-uncompress
|
||||
(cons (if (numberp fetch-old)
|
||||
(max 1 (- (car articles) fetch-old))
|
||||
1)
|
||||
|
|
@ -3694,7 +3695,7 @@ has been fetched."
|
|||
|
||||
;; Clip this list to the headers that will
|
||||
;; actually be returned
|
||||
(setq fetched-articles (gnus-list-range-intersection
|
||||
(setq fetched-articles (range-list-intersection
|
||||
(cdr fetched-articles)
|
||||
(cons min max)))
|
||||
|
||||
|
|
@ -3703,7 +3704,7 @@ has been fetched."
|
|||
;; excluded IDs may be fetchable using HEAD.
|
||||
(if (car tail-fetched-articles)
|
||||
(setq uncached-articles
|
||||
(gnus-list-range-intersection
|
||||
(range-list-intersection
|
||||
uncached-articles
|
||||
(cons (car uncached-articles)
|
||||
(car tail-fetched-articles)))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue