summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Li <darkfeline@felesatra.moe>2021-09-06 10:59:54 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-09-06 11:00:06 +0200
commit7f9ca3b2f4f1a9800d7557f64e25bb3ee5059cba (patch)
tree570d1913a9346f9fef7cedc534766a92f8573fb3
parentbd4a2fc385e33d27831917b8901afcddc4a8b3df (diff)
downloademacs-7f9ca3b2f4f1a9800d7557f64e25bb3ee5059cba.tar.gz
Make `gnus-group-use-permanent-levels' work better
* lisp/gnus/gnus-group.el (gnus-group-default-level): Removed implicit setting of gnus-group-use-permanent-levels. (gnus-group-list-groups): Set gnus-group-use-permanent-levels explicitly. (gnus-group-get-new-news): Set gnus-group-use-permanent-levels explicitly (bug#50417). (gnus-group-get-new-news): When the user has given a numeric prefix, use that as the list level.
-rw-r--r--lisp/gnus/gnus-group.el28
1 files changed, 17 insertions, 11 deletions
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index b1134397e55..4eea2df12bb 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -1176,11 +1176,11 @@ The following commands are available:
(defun gnus-group-default-level (&optional level number-or-nil)
(cond
(gnus-group-use-permanent-levels
- (or (setq gnus-group-use-permanent-levels
- (or level (if (numberp gnus-group-use-permanent-levels)
- gnus-group-use-permanent-levels
- (or (gnus-group-default-list-level)
- gnus-level-subscribed))))
+ (or level
+ (if (numberp gnus-group-use-permanent-levels)
+ gnus-group-use-permanent-levels
+ (or (gnus-group-default-list-level)
+ gnus-level-subscribed))
(gnus-group-default-list-level) gnus-level-subscribed))
(number-or-nil
level)
@@ -1228,20 +1228,23 @@ The following commands are available:
(let ((charset (gnus-group-name-charset nil string)))
(gnus-group-name-decode string charset)))
-(defun gnus-group-list-groups (&optional level unread lowest)
+(defun gnus-group-list-groups (&optional level unread lowest update-level)
"List newsgroups with level LEVEL or lower that have unread articles.
Default is all subscribed groups.
If argument UNREAD is non-nil, groups with no unread articles are also
listed.
-Also see the `gnus-group-use-permanent-levels' variable."
+Also see the `gnus-group-use-permanent-levels' variable. If this
+variable is non-nil, and UPDATE-LEVEL is non-nil (which is the
+case interactively), the level will be updated by this command."
(interactive
(list (if current-prefix-arg
(prefix-numeric-value current-prefix-arg)
(or
(gnus-group-default-level nil t)
(gnus-group-default-list-level)
- gnus-level-subscribed)))
+ gnus-level-subscribed))
+ nil nil t)
gnus-group-mode)
(unless level
(setq level (car gnus-group-list-mode)
@@ -1288,7 +1291,9 @@ Also see the `gnus-group-use-permanent-levels' variable."
(goto-char (point-max))
(forward-line -1)))))))
;; Adjust cursor point.
- (gnus-group-position-point)))
+ (gnus-group-position-point)
+ (when (and update-level gnus-group-use-permanent-levels)
+ (setq gnus-group-use-permanent-levels level))))
(defun gnus-group-list-level (level &optional all)
"List groups on LEVEL.
@@ -4205,8 +4210,9 @@ otherwise all levels below ARG will be scanned too."
(gnus-check-reasonable-setup)
(gnus-run-hooks 'gnus-after-getting-new-news-hook)
- (gnus-group-list-groups (and (numberp arg)
- (max (car gnus-group-list-mode) arg)))))
+ (gnus-group-list-groups (and (numberp arg) arg))
+ (when gnus-group-use-permanent-levels
+ (setq gnus-group-use-permanent-levels (gnus-group-default-level arg)))))
(defun gnus-group-get-new-news-this-group (&optional n dont-scan)
"Check for newly arrived news in the current group (and the N-1 next groups).