GNU bug report logs - #50417
27.2; Unintuitive behavior with gnus-group-use-permanent-levels and g

Previous Next

Packages: gnus, emacs;

Reported by: Allen Li <darkfeline <at> felesatra.moe>

Date: Mon, 6 Sep 2021 00:20:01 UTC

Severity: normal

Found in version 27.2

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50417 in the body.
You can then email your comments to 50417 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#50417; Package emacs,gnus. (Mon, 06 Sep 2021 00:20:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Allen Li <darkfeline <at> felesatra.moe>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org. (Mon, 06 Sep 2021 00:20:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Allen Li <darkfeline <at> felesatra.moe>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.2; Unintuitive behavior with gnus-group-use-permanent-levels and g
Date: Sun, 05 Sep 2021 17:19:30 -0700
[Message part 1 (text/plain, inline)]
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.

[0001-Set-gnus-group-use-permanent-levels-explicitly.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
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

Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#50417; Package emacs,gnus. (Mon, 06 Sep 2021 09:02:01 GMT) Full text and rfc822 format available.

Message #8 received at 50417 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Allen Li <darkfeline <at> felesatra.moe>
Cc: 50417 <at> debbugs.gnu.org
Subject: Re: bug#50417: 27.2; Unintuitive behavior with
 gnus-group-use-permanent-levels and g
Date: Mon, 06 Sep 2021 11:01:04 +0200
Allen Li <darkfeline <at> felesatra.moe> writes:

> I have attached an untested patch to that effect.

Thanks -- it didn't quite work (because `gnus-group-list-groups' just
set the level back to the max again), but I tweaked it a bit and pushed
to Emacs 28, and it seems to work for me now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 50417 <at> debbugs.gnu.org and Allen Li <darkfeline <at> felesatra.moe> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 06 Sep 2021 09:02:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 04 Oct 2021 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 197 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.