From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: dick Newsgroups: gmane.emacs.bugs Subject: bug#36737: patch Date: Fri, 19 Jul 2019 21:47:31 -0400 Message-ID: <875znxiij0.fsf@dick.i-did-not-set--mail-host-address--so-tickle-me> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="120228"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) To: 36737@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jul 20 06:58:11 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hohRj-000VCj-8q for geb-bug-gnu-emacs@m.gmane.org; Sat, 20 Jul 2019 06:58:11 +0200 Original-Received: from localhost ([::1]:49658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hohRh-0003rv-TF for geb-bug-gnu-emacs@m.gmane.org; Sat, 20 Jul 2019 00:58:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43906) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hohRd-0003q1-S4 for bug-gnu-emacs@gnu.org; Sat, 20 Jul 2019 00:58:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hohRc-0006nF-Gn for bug-gnu-emacs@gnu.org; Sat, 20 Jul 2019 00:58:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47905) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hohRc-0006n9-Cx for bug-gnu-emacs@gnu.org; Sat, 20 Jul 2019 00:58:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hohRc-0001LH-Bq for bug-gnu-emacs@gnu.org; Sat, 20 Jul 2019 00:58:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: dick Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Jul 2019 04:58:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36737 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15635986545101 (code B ref -1); Sat, 20 Jul 2019 04:58:04 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Jul 2019 04:57:34 +0000 Original-Received: from localhost ([127.0.0.1]:56724 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hohR7-0001K7-LB for submit@debbugs.gnu.org; Sat, 20 Jul 2019 00:57:34 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45977) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hoeTJ-0005K4-7e for submit@debbugs.gnu.org; Fri, 19 Jul 2019 21:47:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46308) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hoeTH-0002xk-P7 for bug-gnu-emacs@gnu.org; Fri, 19 Jul 2019 21:47:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hoeTG-0006pV-Bd for bug-gnu-emacs@gnu.org; Fri, 19 Jul 2019 21:47:35 -0400 Original-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 ) id 1hoeTG-0006pJ-77 for bug-gnu-emacs@gnu.org; Fri, 19 Jul 2019 21:47:34 -0400 Original-Received: by mail-qk1-x730.google.com with SMTP id g18so24665638qkl.3 for ; 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) Original-Received: from localhost ([100.33.98.8]) by smtp.gmail.com with ESMTPSA id k123sm13784956qkf.13.2019.07.19.18.47.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Jul 2019 18:47:32 -0700 (PDT) X-Google-Original-From: dick X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Mailman-Approved-At: Sat, 20 Jul 2019 00:57:31 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:163442 Archived-At: --=-=-= Content-Type: text/plain Duplicate of preceding patch from priapushk@gmail.com --=-=-= 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 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 --=-=-=--