GNU bug report logs - #36737
gnus-topic-mode clobbers gnus-group-change-level-function

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: dick <priapushk@HIDDEN>; merged with #36735; dated Sat, 20 Jul 2019 04:58:04 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Merged 36735 36737. Request was from dick <dick.r.chiang@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Disconnected #36736 from all other report(s). Request was from dick <dick.r.chiang@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Disconnected #36735 from all other report(s). Request was from dick <dick.r.chiang@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Changed bug title to 'gnus-topic-mode clobbers gnus-group-change-level-function' from 'patch' Request was from Noam Postavsky <npostavs@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Merged 36735 36736 36737. Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 20 Jul 2019 04:57:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 20 00:57:34 2019
Received: from localhost ([127.0.0.1]:56724 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hohR7-0001K7-LB
	for submit <at> debbugs.gnu.org; Sat, 20 Jul 2019 00:57:34 -0400
Received: from lists.gnu.org ([209.51.188.17]:45977)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <priapushk@HIDDEN>) id 1hoeTJ-0005K4-7e
 for submit <at> debbugs.gnu.org; Fri, 19 Jul 2019 21:47:37 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:46308)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <priapushk@HIDDEN>) id 1hoeTH-0002xk-P7
 for bug-gnu-emacs@HIDDEN; Fri, 19 Jul 2019 21:47:37 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <priapushk@HIDDEN>) id 1hoeTG-0006pV-Bd
 for bug-gnu-emacs@HIDDEN; Fri, 19 Jul 2019 21:47:35 -0400
Received: from mail-qk1-x730.google.com ([2607:f8b0:4864:20::730]:36289)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <priapushk@HIDDEN>) id 1hoeTG-0006pJ-77
 for bug-gnu-emacs@HIDDEN; Fri, 19 Jul 2019 21:47:34 -0400
Received: by mail-qk1-x730.google.com with SMTP id g18so24665638qkl.3
 for <bug-gnu-emacs@HIDDEN>; Fri, 19 Jul 2019 18:47:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:user-agent:mime-version;
 bh=z2lk+0bvECjlfZY3NAeg30aCEHj/wOQgYnWpLtVMavU=;
 b=O80mDTM7jA+7kZWHPm+P1etfpzjDSfTd+1gSfkuttdGpRuzpUfGHqK+vdmdin22fbV
 OlPszrFSLadrLQMGYyraVtyEdlge0KtWfzO0v8ZmAbVXEa3HSSss3M+0H4RogrxfGG5f
 h27Pf834H0kBteRatwp2jjYQ7jyqxWMGgdhN+8O4dzdjcnx4taRdHHYKmwATpUNPPOOp
 ZvypoMfVjLvU8r+A5D3ZJ5FDe0KpwI1hYGXkXpis0vwyixG9UzAFAwwotNT5tpXUwA+Y
 XPuJWf9MG9A24FvcDht4tEN2XvIYLI2mZ5FwoQlO0UH8pkNkE5RVgyw3+iLM9OMkkKWu
 ASsQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:user-agent
 :mime-version;
 bh=z2lk+0bvECjlfZY3NAeg30aCEHj/wOQgYnWpLtVMavU=;
 b=csQyQHBvyQRH1sYDsGyYJFU4f4B29serbVJOw9IP3FHfyU/nJbx5BoN53ouSFdtCsM
 uQpPjvvXqIkmBLgkl+3XX1Gxz8/+6K3PgKcmqynLEZ7db1I8BXh1fBcBmIQ844SLPrNW
 mIh4mDxcBhY3OsG/1fW1trrw+oZmjbewraidbevJBLI6THb2exMy/B0djoDVjMi2y5An
 cwy8MROq6STggaYi7/kgem2lapdQYY+j48rjjqejHlPlhDJmn2S3K2yP00Au8dmrUPh7
 60u4jW+x8grFEd1rezRudg4gsmrKfwaR6myOK4pg2L1ntYK4Cvbhj9tbxGTcjPn8hYO1
 FKoA==
X-Gm-Message-State: APjAAAXowS9nXvbXD2CtEx7Muatmxtcb0jxawQo7oiAOw0WPzA6N1+KA
 e+l1mVyLP/1oLJIUA34Oc4P5QOQz
X-Google-Smtp-Source: APXvYqzC2L7QKRfwmTr6cValSXlP7EOIlePSgd4K2JzULCgx0/swbZNJFzPwSFZmnzTAY5pf08sBVA==
X-Received: by 2002:a37:9dc8:: with SMTP id
 g191mr37884259qke.431.1563587253258; 
 Fri, 19 Jul 2019 18:47:33 -0700 (PDT)
Received: from localhost ([100.33.98.8])
 by smtp.gmail.com with ESMTPSA id k123sm13784956qkf.13.2019.07.19.18.47.32
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 19 Jul 2019 18:47:32 -0700 (PDT)
From: dick <priapushk@HIDDEN>
X-Google-Original-From: dick <dick.r.chiang@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: patch
Date: Fri, 19 Jul 2019 21:47:31 -0400
Message-ID: <875znxiij0.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2607:f8b0:4864:20::730
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sat, 20 Jul 2019 00:57:31 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain

Duplicate of preceding patch from priapushk@HIDDEN

--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Avoid-clobbering-gnus-group-change-level-function.patch
Content-Description: patch

From b8da0de6541fa5a966c30306c1f135bc60590ff0 Mon Sep 17 00:00:00 2001
From: dickmao <none>
Date: Fri, 19 Jul 2019 18:18:31 -0400
Subject: [PATCH] Avoid clobbering gnus-group-change-level-function

Gnus backends may add additional hooks via
`gnus-group-change-level-functions' but should not modify
`gnus-group-change-level-function'.
* lisp/gnus/gnus-group.el (gnus-group-kill-group): run-hook-with-args
  on `gnus-group-change-level-functions'.
* lisp/gnus/gnus-srvr.el (gnus-server-kill-server): run-hook-with-args
  on `gnus-group-change-level-functions'.
* lisp/gnus/gnus-start.el (gnus-group-change-level): run-hook-with-args
  on `gnus-group-change-level-functions'.
* lisp/gnus/gnus-topic.el (gnus-topic-mode): avoid clobbering
  `gnus-group-change-level-function'.  Mirror LOCAL flag in `add-hook'
  to `remove-hook' for `gnus-check-bogus-groups-hook'.
* lisp/gnus/gnus.el (gnus-group-change-level-function): define abnormal
  hook variable `gnus-group-change-level-functions'.
---
 lisp/gnus/gnus-group.el |  5 ++---
 lisp/gnus/gnus-srvr.el  |  5 ++---
 lisp/gnus/gnus-start.el |  5 ++---
 lisp/gnus/gnus-topic.el |  8 ++++----
 lisp/gnus/gnus.el       | 13 +++++++++++--
 5 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 299ebdec50..d95aa1ad8c 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -3919,9 +3919,8 @@ gnus-group-kill-group
 	(setq gnus-newsrc-alist
 	      (delq (assoc group gnus-newsrc-alist)
 		    gnus-newsrc-alist))
-	(when gnus-group-change-level-function
-	  (funcall gnus-group-change-level-function
-		   group gnus-level-killed 3))
+	(run-hook-with-args 'gnus-group-change-level-functions
+                            group gnus-level-killed 3)
 	(cond
 	 ((setq entry (gnus-group-entry group))
 	  (push (cons (car entry) (nth 1 entry))
diff --git a/lisp/gnus/gnus-srvr.el b/lisp/gnus/gnus-srvr.el
index 972ff28e63..8d0b36298f 100644
--- a/lisp/gnus/gnus-srvr.el
+++ b/lisp/gnus/gnus-srvr.el
@@ -432,9 +432,8 @@ gnus-server-kill-server
 	(setq gnus-newsrc-alist
 	      (delq (assoc group gnus-newsrc-alist)
 		    gnus-newsrc-alist))
-	(when gnus-group-change-level-function
-	  (funcall gnus-group-change-level-function
-		   group gnus-level-killed 3)))))
+        (run-hook-with-args 'gnus-group-change-level-functions
+                            group gnus-level-killed 3))))
   (gnus-server-position-point))
 
 (defun gnus-server-yank-server ()
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index d726ee5aab..f5ded7a4fa 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -1351,9 +1351,8 @@ gnus-group-change-level
 	  (gnus-dribble-enter
 	   (format "(gnus-group-set-info '%S)" info)
 	   (concat "^(gnus-group-set-info '(\"" (regexp-quote group) "\"")))))
-      (when gnus-group-change-level-function
-	(funcall gnus-group-change-level-function
-		 group level oldlevel previous)))))
+      (run-hook-with-args 'gnus-group-change-level-functions
+                          group level oldlevel previous))))
 
 (defun gnus-check-bogus-newsgroups (&optional confirm)
   "Remove bogus newsgroups.
diff --git a/lisp/gnus/gnus-topic.el b/lisp/gnus/gnus-topic.el
index e2c728df8f..1daee1dcfb 100644
--- a/lisp/gnus/gnus-topic.el
+++ b/lisp/gnus/gnus-topic.el
@@ -1143,7 +1143,7 @@ gnus-topic-mode
 	   'gnus-topic-update-topics-containing-group)
       (set (make-local-variable 'gnus-group-sort-alist-function)
 	   'gnus-group-sort-topic)
-      (setq gnus-group-change-level-function 'gnus-topic-change-level)
+      (add-hook 'gnus-group-change-level-functions 'gnus-topic-change-level nil 'local)
       (setq gnus-goto-missing-group-function 'gnus-topic-goto-missing-group)
       (add-hook 'gnus-check-bogus-groups-hook 'gnus-topic-clean-alist
 		nil 'local)
@@ -1154,8 +1154,8 @@ gnus-topic-mode
     ;; Remove topic infestation.
     (unless gnus-topic-mode
       (remove-hook 'gnus-summary-exit-hook 'gnus-topic-update-topic)
-      (setq gnus-group-change-level-function nil)
-      (remove-hook 'gnus-check-bogus-groups-hook 'gnus-topic-clean-alist)
+      (remove-hook 'gnus-group-change-level-functions 'gnus-topic-change-level 'local)
+      (remove-hook 'gnus-check-bogus-groups-hook 'gnus-topic-clean-alist 'local)
       (setq gnus-group-prepare-function 'gnus-group-prepare-flat)
       (setq gnus-group-sort-alist-function 'gnus-group-sort-flat))
     (when (called-interactively-p 'any)
@@ -1741,7 +1741,7 @@ gnus-topic-move
 
 (defun gnus-subscribe-topics (newsgroup)
   (catch 'end
-    (let (match gnus-group-change-level-function)
+    (let (match gnus-group-change-level-functions)
       (dolist (topic (gnus-topic-list))
 	(when (and (setq match (cdr (assq 'subscribe
 					  (gnus-topic-parameters topic))))
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index 9ee7db9e20..abb8b7c9f8 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -2112,10 +2112,19 @@ gnus-apply-kill-hook
 
 (defcustom gnus-group-change-level-function nil
   "Function run when a group level is changed.
-It is called with three parameters -- GROUP, LEVEL and OLDLEVEL."
+It is called with four parameters -- GROUP, LEVEL, OLDLEVEL, and optionally PREVIOUS"
   :group 'gnus-group-levels
   :type '(choice (const nil)
-		 function))
+		 function)
+  :set (lambda (symbol value)
+         (set-default symbol value)
+         (when value
+           (set-default 'gnus-group-change-level-functions (list value)))))
+
+(defvar gnus-group-change-level-functions nil
+  "\"Abnormal\" hook run when a group level is changed.
+Each function element is called with three parameters -- GROUP, LEVEL, OLDLEVEL, and optionally PREVIOUS.
+Its default value is determined by the :set method of `gnus-group-change-level-function'")
 
 ;;; Face thingies.
 
-- 
2.22.0


--=-=-=--




Acknowledgement sent to dick <priapushk@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#36737; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 23 Jul 2019 22:30:02 UTC

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