[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] feature/gnus-select2 d2e0389 19/32: Improve group-info han
From: |
Andrew G Cohen |
Subject: |
[Emacs-diffs] feature/gnus-select2 d2e0389 19/32: Improve group-info handling in nnselect |
Date: |
Sun, 16 Dec 2018 06:54:03 -0500 (EST) |
branch: feature/gnus-select2
commit d2e038962b84126c39d6f515088607286f3382b6
Author: Andrew G Cohen <address@hidden>
Commit: Andrew G Cohen <address@hidden>
Improve group-info handling in nnselect
* lisp/gnus/nnselect.el (nnselect-request-group):
(nnselect-push-info): Use info argument to functions or retrieve the
group info. If the info is null (for example the group might have been
killed) don't try to update it.
---
lisp/gnus/nnselect.el | 146 +++++++++++++++++++++++++-------------------------
1 file changed, 74 insertions(+), 72 deletions(-)
diff --git a/lisp/gnus/nnselect.el b/lisp/gnus/nnselect.el
index 1357c4c..08c8939 100644
--- a/lisp/gnus/nnselect.el
+++ b/lisp/gnus/nnselect.el
@@ -185,7 +185,7 @@ If this variable is nil, or if the provided function
returns nil,
(let ((backend (or (car (gnus-server-to-method server)) 'nnselect)))
(nnoo-change-server backend server definitions)))
-(deffoo nnselect-request-group (group &optional server dont-check _info)
+(deffoo nnselect-request-group (group &optional server dont-check info)
(let ((group (nnselect-possibly-change-group group server))
length)
;; Check for cached select result or run the selection and cache
@@ -196,7 +196,8 @@ If this variable is nil, or if the provided function
returns nil,
(setq nnselect-artlist
(nnselect-run
(gnus-group-get-parameter group 'nnselect-specs t))))
- (nnselect-request-update-info group (gnus-get-info group)))
+ (nnselect-request-update-info
+ group (or info (gnus-get-info group))))
(if (zerop (setq length (nnselect-artlist-length nnselect-artlist)))
(progn
(nnselect-close-group group)
@@ -696,77 +697,78 @@ originating groups."
(let* ((group-info (gnus-get-info artgroup))
(old-unread (gnus-list-of-unread-articles artgroup))
newmarked)
- (pcase-dolist (`(,_mark . ,type) gnus-article-mark-lists)
- (let ((select-type
- (sort
- (cdr (assoc artgroup (alist-get type mark-list)))
- '<)) list)
- (setq list
- (gnus-uncompress-range
- (gnus-add-to-range
- (gnus-remove-from-range
- (alist-get type (gnus-info-marks group-info))
- artlist)
- select-type)))
-
- (when list
- ;; Get rid of the entries of the articles that have the
- ;; default score.
- (when (and (eq type 'score)
- gnus-save-score
- list)
- (let* ((arts list)
- (prev (cons nil list))
- (all prev))
- (while arts
- (if (or (not (consp (car arts)))
- (= (cdar arts) gnus-summary-default-score))
- (setcdr prev (cdr arts))
- (setq prev arts))
- (setq arts (cdr arts)))
- (setq list (cdr all)))))
-
- (when (or (eq (gnus-article-mark-to-type type) 'list)
- (eq (gnus-article-mark-to-type type) 'range))
+ (when group-info
+ (pcase-dolist (`(,_mark . ,type) gnus-article-mark-lists)
+ (let ((select-type
+ (sort
+ (cdr (assoc artgroup (alist-get type mark-list)))
+ '<)) list)
(setq list
- (gnus-compress-sequence (sort list '<) t)))
-
- ;; When exiting the group, everything that's previously been
- ;; unseen is now seen.
- (when (eq type 'seen)
- (setq list (gnus-range-add
- list (cdr (assoc artgroup select-unseen)))))
-
- (when (or list (eq type 'unexist))
- (push (cons type list) newmarked))))
-
- (gnus-atomic-progn
- ;; Enter these new marks into the info of the group.
- (if (nthcdr 3 group-info)
- (setcar (nthcdr 3 group-info) newmarked)
- ;; Add the marks lists to the end of the info.
- (when newmarked
- (setcdr (nthcdr 2 group-info) (list newmarked))))
-
- ;; Cut off the end of the info if there's nothing else there.
- (let ((i 5))
- (while (and (> i 2)
- (not (nth i group-info)))
- (when (nthcdr (cl-decf i) group-info)
- (setcdr (nthcdr i group-info) nil))))
-
- ;; update read and unread
- (gnus-update-read-articles
- artgroup
- (gnus-uncompress-range
- (gnus-add-to-range
- (gnus-remove-from-range
- old-unread
- (cdr (assoc artgroup select-reads)))
- (sort (cdr (assoc artgroup select-unreads)) '<))))
- (gnus-get-unread-articles-in-group
- group-info (gnus-active artgroup) t)
- (gnus-group-update-group artgroup t))))))
+ (gnus-uncompress-range
+ (gnus-add-to-range
+ (gnus-remove-from-range
+ (alist-get type (gnus-info-marks group-info))
+ artlist)
+ select-type)))
+
+ (when list
+ ;; Get rid of the entries of the articles that have the
+ ;; default score.
+ (when (and (eq type 'score)
+ gnus-save-score
+ list)
+ (let* ((arts list)
+ (prev (cons nil list))
+ (all prev))
+ (while arts
+ (if (or (not (consp (car arts)))
+ (= (cdar arts) gnus-summary-default-score))
+ (setcdr prev (cdr arts))
+ (setq prev arts))
+ (setq arts (cdr arts)))
+ (setq list (cdr all)))))
+
+ (when (or (eq (gnus-article-mark-to-type type) 'list)
+ (eq (gnus-article-mark-to-type type) 'range))
+ (setq list
+ (gnus-compress-sequence (sort list '<) t)))
+
+ ;; When exiting the group, everything that's previously been
+ ;; unseen is now seen.
+ (when (eq type 'seen)
+ (setq list (gnus-range-add
+ list (cdr (assoc artgroup select-unseen)))))
+
+ (when (or list (eq type 'unexist))
+ (push (cons type list) newmarked))))
+
+ (gnus-atomic-progn
+ ;; Enter these new marks into the info of the group.
+ (if (nthcdr 3 group-info)
+ (setcar (nthcdr 3 group-info) newmarked)
+ ;; Add the marks lists to the end of the info.
+ (when newmarked
+ (setcdr (nthcdr 2 group-info) (list newmarked))))
+
+ ;; Cut off the end of the info if there's nothing else there.
+ (let ((i 5))
+ (while (and (> i 2)
+ (not (nth i group-info)))
+ (when (nthcdr (cl-decf i) group-info)
+ (setcdr (nthcdr i group-info) nil))))
+
+ ;; update read and unread
+ (gnus-update-read-articles
+ artgroup
+ (gnus-uncompress-range
+ (gnus-add-to-range
+ (gnus-remove-from-range
+ old-unread
+ (cdr (assoc artgroup select-reads)))
+ (sort (cdr (assoc artgroup select-unreads)) '<))))
+ (gnus-get-unread-articles-in-group
+ group-info (gnus-active artgroup) t)
+ (gnus-group-update-group artgroup t)))))))
(declare-function gnus-registry-get-id-key "gnus-registry" (id key))
- [Emacs-diffs] feature/gnus-select2 5be0d2a 12/32: Disable nnselect-server-opened check, (continued)
- [Emacs-diffs] feature/gnus-select2 5be0d2a 12/32: Disable nnselect-server-opened check, Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 f43d8d8 23/32: * lisp/gnus/nnselect.el (nnselect-request-group): Don't close group., Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 c1c5b4b 08/32: Introduce summary-local variable gnus-newsgroup-selection, Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 e5ea691 17/32: Use gnus-newsgroup-selection instead of nnselect-artlist, Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 1388539 11/32: Improve nnselect-request-article, Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 7df041f 10/32: Remove unnecessary check gnus-nnselect-group-p, Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 c87252e 15/32: New gnus summary sorting functions on rsv, Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 514f0cb 04/32: Temporary function to ease search group creation, Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 3444486 16/32: Fix pushing marks on nnselect exit, Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 fde0e40 21/32: Restore accidentally remove gnus-summary-make-search-group, Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 d2e0389 19/32: Improve group-info handling in nnselect,
Andrew G Cohen <=
- [Emacs-diffs] feature/gnus-select2 6111aa1 09/32: Don't stomp on local variables in gnus-msg, Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 c9c16c9 22/32: * lisp/gnus/nnselect.el (nnselect-server-opened): Just return t., Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 2174d0f 20/32: Improve nnselect-request-article, Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 8ad88ac 24/32: * lisp/gnus/nnselect.el (nnselect-request-rename-group): Allow it., Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 73c0da2 27/32: Improve search and select group creation, Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 fe5f3c2 32/32: Set gnus-newsgroup-selection in the summary buffer, Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 5868104 30/32: Allow automatic scanning of nnselect groups, Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 0693d49 31/32: Remove nnselect-artlist variable in nnselect, Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 5699fda 28/32: * lisp/gnus/gnus-srvr.el (gnus-server-mode-map): Use ephemeral group, Andrew G Cohen, 2018/12/16
- [Emacs-diffs] feature/gnus-select2 465b580 29/32: * lisp/gnus/nnir.el (nnir-make-specs): Use the current buffer., Andrew G Cohen, 2018/12/16