From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#33263: 27.0.50; Tidying up Gnus modes Date: Mon, 05 Nov 2018 09:51:22 -0800 Message-ID: <87o9b3za3p.fsf@ericabrahamsen.net> References: <877ehs1bgq.fsf@ericabrahamsen.net> <875zxbipby.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1541440208 28723 195.159.176.226 (5 Nov 2018 17:50:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 5 Nov 2018 17:50:08 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: 33263@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 05 18:50:04 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gJj0j-0007Hz-W8 for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Nov 2018 18:50:02 +0100 Original-Received: from localhost ([::1]:36774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJj2p-0005k7-Su for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Nov 2018 12:52:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJj2k-0005jj-0i for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 12:52:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJj2g-0008Ic-KM for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 12:52:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59534) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gJj2g-0008IE-FH for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 12:52:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gJj2g-0006u9-DB for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 12:52:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <877ehs1bgq.fsf@ericabrahamsen.net> Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Nov 2018 17:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33263 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.154144031926532 (code B ref -1); Mon, 05 Nov 2018 17:52:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Nov 2018 17:51:59 +0000 Original-Received: from localhost ([127.0.0.1]:35559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gJj2d-0006ts-Cv for submit@debbugs.gnu.org; Mon, 05 Nov 2018 12:51:59 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43060) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gJj2b-0006tf-P7 for submit@debbugs.gnu.org; Mon, 05 Nov 2018 12:51:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJj2Q-000878-Sa for submit@debbugs.gnu.org; Mon, 05 Nov 2018 12:51:48 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:59429) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gJj2P-00086F-KU for submit@debbugs.gnu.org; Mon, 05 Nov 2018 12:51:46 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJj2O-0005j0-NW for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 12:51:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJj2H-000801-PG for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 12:51:41 -0500 Original-Received: from [195.159.176.226] (port=37611 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gJj2G-0007vE-Cp for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 12:51:37 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1gJj03-0006Wd-6j for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 18:49:19 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 51 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:vYgEcZ9lxtRHCG1zRsO36MIapZI= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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: 208.118.235.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:152069 Archived-At: Noam Postavsky writes: > Eric Abrahamsen writes: > >> +(defvar gnus-browse-mode-map (make-keymap)) >> >> (unless gnus-browse-mode-map >> - (setq gnus-browse-mode-map (make-keymap)) >> + (defvar gnus-browse-mode-map (make-keymap)) > > This doesn't look right. Hmm, you're right, I think I got confused there. TBH I don't really know why these things are wrapped in `unless', but I think what should have happened is that `gnus-browse-mode-map' is first defvar'ed to nil, and later setq'ed to (make-keymap). >> -(defun gnus-summary-mode (&optional group) >> +(define-derived-mode gnus-summary-mode gnus-mode "Summary" >> "Major mode for reading articles. > >> - (gnus-summary-mode group) >> + (setq gnus-newsgroup-name group) >> + (gnus-summary-mode) >> (when (gnus-group-quit-config group) > > Where does GROUP come from now? GROUP has always been passed down through gnus-group-read-group (which picks it up from the group under point) => gnus-summary-read-group => gnus-summary-read-group-1 => gnus-summary-setup-buffer => gnus-summary-mode. When gnus-summary-mode was a function it was passed GROUP as an argument and set it as the (buffer-local) gnus-newsgroup-name variable. I couldn't see anything in the rest of gnus-summary-mode that would need that variable set, but you never know if Gnus is checking something four levels deep. So I pulled that up and set it in gnus-summary-setup-buffer, before the call to the major mode, forgetting that calling gnus-summary-mode would of course clear out buffer-local variables. *And* failing to notice that gnus-summary-setup-buffer sets the variable *again* later on. So it was originally set twice. I've been testing for a while, and don't think anything called from the gnus-summary-mode code needs to be aware of gnus-newsgroup-name, but I will look a little closer. Anything that *does* rely on knowing which group we're opening should definitely be hoisted up to gnus-summary-setup-buffer. Then I'll just delete the first setting of gnus-newsgroup-name and leave the later one. Thanks for looking at this.