bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50417: 27.2; Unintuitive behavior with gnus-group-use-permanent-leve


From: Allen Li
Subject: bug#50417: 27.2; Unintuitive behavior with gnus-group-use-permanent-levels and g
Date: Sun, 05 Sep 2021 17:19:30 -0700

gnus-group-use-permanent-levels does not work as expected with g
(gnus-group-get-new-news).

The problem is with these two lines:

  (defun gnus-group-get-new-news (&optional arg one-level)
    "Get newly arrived articles.
  If ARG is a number, it specifies which levels you are interested in
  re-scanning.  If ARG is non-nil and not a number, this will force
  \"hard\" re-reading of the active files from all servers.
  If ONE-LEVEL is not nil, then re-scan only the specified level,
  otherwise all levels below ARG will be scanned too."
    (interactive "P")
    (require 'nnmail)
    (let ((gnus-inhibit-demon t)
          ;; Binding this variable will inhibit multiple fetchings
          ;; of the same mail source.
          (nnmail-fetched-sources (list t)))
      (gnus-run-hooks 'gnus-get-top-new-news-hook)
      (gnus-run-hooks 'gnus-get-new-news-hook)

      ;; Read any slave files.
      (unless gnus-slave
        (gnus-master-read-slave-newsrc))

=>    (gnus-get-unread-articles (gnus-group-default-level arg t)
                                nil one-level)

      ;; If the user wants it, we scan for new groups.
      (when (eq gnus-check-new-newsgroups 'always)
        (gnus-find-new-newsgroups))

      (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)))))

The gnus-get-unread-articles call uses the provided ARG and sets the
permament level (via gnus-group-default-level) as expected.  However,
gnus-group-list-groups gets the max of ARG and the list level ((car
gnus-group-list-mode)), and gnus-group-list-groups also calls
gnus-group-default-level which sets the permanent level.

Example:

1. User presses M-5 l, which sets both the permanent level and the list
level to 5.
2. User presses M-1 g.
2a. First, this sets the permanent level to 1 in gnus-get-unread-articles.
2b. Next, this uses the list level (5) to call gnus-group-list-groups
which sets the permanent level back to 5.

Expected:

After the M-1 g, the user expects that the permanent level is set to 1.

I think the best way to fix this is to not implicitly set
gnus-group-use-permanent-levels in gnus-group-default-level and instead
explicitly set the permanent level at the end of gnus-group-list-groups
and gnus-group-get-new-news.

I have attached an untested patch to that effect.

Attachment: 0001-Set-gnus-group-use-permanent-levels-explicitly.patch
Description: Text Data

In GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo 
version 1.17.4)
 of 2021-03-26 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Arch Linux

reply via email to

[Prev in Thread] Current Thread [Next in Thread]