From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.bugs Subject: bug#33653: 27.0.50; Change Gnus obarrays-as-hash-tables into real hash tables Date: Thu, 11 Apr 2019 22:29:23 +0100 Message-ID: <87wok0s024.fsf@tcd.ie> References: <8736raz3ec.fsf@ericabrahamsen.net> <87y392xoht.fsf@ericabrahamsen.net> <87imxzxa4s.fsf@ericabrahamsen.net> <87a7hn3h3w.fsf@ericabrahamsen.net> <87a7hhtinz.fsf@ericabrahamsen.net> <87imw4f1oo.fsf@ericabrahamsen.net> <874l7i3b8s.fsf@ericabrahamsen.net> <874l7hh43b.fsf@tullinup.koldfront.dk> <87tvfh30lr.fsf@ericabrahamsen.net> <87sgv0z7bb.fsf@tullinup.koldfront.dk> <875zruu35h.fsf@ericabrahamsen.net> 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="174409"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Eric Abrahamsen , Bastien Guerry , Adam =?UTF-8?Q?Sj=C3=B8gren?= , 33653@debbugs.gnu.org To: Katsumi Yamaoka Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Apr 11 23:30:43 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.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hEhHO-000jEq-Mo for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Apr 2019 23:30:42 +0200 Original-Received: from localhost ([127.0.0.1]:55104 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEhHN-0000yR-8f for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Apr 2019 17:30:41 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEhHD-0000yM-Sr for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2019 17:30:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hEhH3-0002U5-Q0 for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2019 17:30:27 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41688) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hEhGl-0002JH-Av for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2019 17:30:08 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hEhGk-0003jK-TC for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2019 17:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Apr 2019 21:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33653 X-GNU-PR-Package: emacs Original-Received: via spool by 33653-submit@debbugs.gnu.org id=B33653.155501818414293 (code B ref 33653); Thu, 11 Apr 2019 21:30:02 +0000 Original-Received: (at 33653) by debbugs.gnu.org; 11 Apr 2019 21:29:44 +0000 Original-Received: from localhost ([127.0.0.1]:55232 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hEhGR-0003iS-Ez for submit@debbugs.gnu.org; Thu, 11 Apr 2019 17:29:43 -0400 Original-Received: from mail-ed1-f46.google.com ([209.85.208.46]:44566) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hEhGP-0003iD-0I for 33653@debbugs.gnu.org; Thu, 11 Apr 2019 17:29:42 -0400 Original-Received: by mail-ed1-f46.google.com with SMTP id d11so6508122edp.11 for <33653@debbugs.gnu.org>; Thu, 11 Apr 2019 14:29:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=BikeMZlRhOyRY6UdfYtdhrC17NtTMPwsxWMiK3ZE118=; b=RPGei0P4pE7Sgr8WKbVabFx0KWFtBWkS77p/7cz46isF5qdO6ftbNeRLB7kuKHy9nX rTSRmHsGtzB5NOEX/srIfjHpIVjJcombteQlR+81pvx2fyVH7VT34PvaYyicnk/f57zf QM2jgSj2UKxRt+9jIcCdjQXQCSD9Br3H4fQIzKQx910q0x5xiS98egSwVWYi0EZSMI/u 4uOk9/QBhRDxnAFsjYb5Gg7PTBZkSAOX+6HnvLOVYcQf3TC5sc7D/SQdRC22Mrig09eO 1zCoonmiHbToFp/Wfi/oQDdGJ7BlrTEID3n/4phJsGBDiNwy+p0UzX1PDoGhIl9bwRZP nvgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=BikeMZlRhOyRY6UdfYtdhrC17NtTMPwsxWMiK3ZE118=; b=YP2ICBO1CQ4x1fyQlIhs9Tm96/Zef1WM7aDTQ8tVjMGzpFPd6/I8/MBuwhXzNIaDRU aP26KkC1z/YzpQ/OnNbkl7dZByAh0PGEVhLL723/y+jgyZFH1zcp4uSrxviCpj0WESpp K3K/HZliHwid7/G4+O2JZDaO0i+EdcGclCwUVbvjXKUOxW9SSngJQd3YQN16Vsr43nju Z+J50L1A2GsH2n6nabOTzZTTmRS7TYtP8jnR24dz/X+qVaz9klrpGHS59anPyuhQe+S5 PZJZObpyfVulsYzEINtAujlqdRzx2waXRpKGt+zVOQBFnsZtEPUiYJ8hIYevzZBENbU0 SulA== X-Gm-Message-State: APjAAAVNkJ29ImBBcini5dCCtR+v1SZrvpbM+BiPC5U3anjhWunCWIh/ PsZjzqzslrU3gGkq+kErQdsTIQ== X-Google-Smtp-Source: APXvYqwAiPvmFgsBg2FuvEJ59XNBcRP2h4ENfgIxxCkwZ76LMYoYc8IbNHYDbJPTFrKYyWuFlqe8yA== X-Received: by 2002:a17:906:5013:: with SMTP id s19mr17219933ejj.203.1555018175118; Thu, 11 Apr 2019 14:29:35 -0700 (PDT) Original-Received: from localhost ([2a02:8084:20e2:c380:f786:805d:f4ab:1006]) by smtp.gmail.com with ESMTPSA id f4sm3557265ejx.55.2019.04.11.14.29.32 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 11 Apr 2019 14:29:33 -0700 (PDT) In-Reply-To: (Katsumi Yamaoka's message of "Fri, 5 Apr 2019 15:44:44 +0900") 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:157521 Archived-At: --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Always-set-gnus-group-property-to-a-group-name.patch >From 5d3eb57ae62decf6316ab7c882cc6f18a9c63ae3 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Thu, 11 Apr 2019 17:24:36 +0100 Subject: [PATCH] Always set gnus-group property to a group name * lisp/gnus/gnus-group.el (gnus-group-prepare-flat-list-dead): Set gnus-group property to a group name, not active info. Simplify surrounding logic. (gnus-group-prepare-flat, gnus-group-goto-group): Use accessor macros. (gnus-group-insert-group-line, gnus-group-new-mail) (gnus-group-mark-group): Write ?\s instead of ? . (gnus-group-group-name, gnus-group-list-active): Simplify. --- lisp/gnus/gnus-group.el | 98 ++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 55 deletions(-) diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index e1554cab8a..b1e4091c97 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -1320,7 +1320,7 @@ gnus-group-prepare-flat gnus-group-listed-groups) ;; List living groups, according to order in `gnus-group-list'. (dolist (g (cdr gnus-group-list)) - (setq info (nth 1 (gethash g gnus-newsrc-hashtb)) + (setq info (gnus-get-info g) group (gnus-info-group info) params (gnus-info-params info) unread (gnus-group-unread group)) @@ -1389,39 +1389,35 @@ gnus-group-prepare-flat-list-dead ;; List zombies and killed lists somewhat faster, which was ;; suggested by Jack Vinson . It does ;; this by ignoring the group format specification altogether. - (let (group) - (if (> (length groups) gnus-group-listing-limit) - (while groups - (setq group (pop groups)) - (when (gnus-group-prepare-logic - group - (or (not regexp) - (and (stringp regexp) (string-match regexp group)) - (and (functionp regexp) (funcall regexp group)))) - (add-text-properties - (point) (prog1 (1+ (point)) - (insert " " mark " *: " - (gnus-group-decoded-name group) - "\n")) - (list 'gnus-group (gethash group gnus-active-hashtb) - 'gnus-unread t - 'gnus-level level)))) - (while groups - (setq group (pop groups)) + (if (nthcdr gnus-group-listing-limit groups) + (dolist (group groups) (when (gnus-group-prepare-logic group - (or (not regexp) - (and (stringp regexp) (string-match regexp group)) - (and (functionp regexp) (funcall regexp group)))) - (gnus-group-insert-group-line - group level nil - (let ((active (gnus-active group))) - (if active - (if (zerop (cdr active)) - 0 - (- (1+ (cdr active)) (car active))) - nil)) - (gnus-method-simplify (gnus-find-method-for-group group)))))))) + (cond ((not regexp)) + ((stringp regexp) (string-match-p regexp group)) + ((functionp regexp) (funcall regexp group)))) + (add-text-properties + (point) (prog1 (1+ (point)) + (insert " " mark " *: " + (gnus-group-decoded-name group) + "\n")) + (list 'gnus-group group + 'gnus-unread t + 'gnus-level level)))) + (dolist (group groups) + (when (gnus-group-prepare-logic + group + (cond ((not regexp)) + ((stringp regexp) (string-match-p regexp group)) + ((functionp regexp) (funcall regexp group)))) + (gnus-group-insert-group-line + group level nil + (let ((active (gnus-active group))) + (and active + (if (zerop (cdr active)) + 0 + (- (cdr active) (car active) -1)))) + (gnus-method-simplify (gnus-find-method-for-group group))))))) (defun gnus-group-update-group-line () "Update the current line in the group buffer." @@ -1527,7 +1523,7 @@ gnus-group-insert-group-line (int-to-string (max 0 (- gnus-tmp-number-total number))) "*")) (gnus-tmp-subscribed - (cond ((<= gnus-tmp-level gnus-level-subscribed) ? ) + (cond ((<= gnus-tmp-level gnus-level-subscribed) ?\s) ((<= gnus-tmp-level gnus-level-unsubscribed) ?U) ((= gnus-tmp-level gnus-level-zombie) ?Z) (t ?K))) @@ -1546,7 +1542,7 @@ gnus-group-insert-group-line (gnus-tmp-moderated (if (and gnus-moderated-hashtb (gethash gnus-tmp-group gnus-moderated-hashtb)) - ?m ? )) + ?m ?\s)) (gnus-tmp-moderated-string (if (eq gnus-tmp-moderated ?m) "(m)" "")) (gnus-tmp-group-icon (gnus-group-get-icon gnus-tmp-group)) @@ -1560,15 +1556,15 @@ gnus-group-insert-group-line (if (and (numberp number) (zerop number) (cdr (assq 'tick gnus-tmp-marked))) - ?* ? )) + ?* ?\s)) (gnus-tmp-summary-live (if (and (not gnus-group-is-exiting-p) (gnus-buffer-live-p (gnus-summary-buffer-name gnus-tmp-group))) - ?* ? )) + ?* ?\s)) (gnus-tmp-process-marked (if (member gnus-tmp-group gnus-group-marked) - gnus-process-mark ? )) + gnus-process-mark ?\s)) (buffer-read-only nil) beg end gnus-tmp-header) ; passed as parameter to user-funcs. @@ -1768,10 +1764,8 @@ gnus-group-set-mode-line (defun gnus-group-group-name () "Get the name of the newsgroup on the current line." (let ((group (get-text-property (point-at-bol) 'gnus-group))) - (when group - (if (stringp group) - group - (symbol-name group))))) + (cond ((stringp group) group) + (group (symbol-name group))))) (defun gnus-group-group-level () "Get the level of the newsgroup on the current line." @@ -1791,7 +1785,7 @@ gnus-group-group-unread (defun gnus-group-new-mail (group) (if (nnmail-new-mail-p (gnus-group-real-name group)) gnus-new-mail-mark - ? )) + ?\s)) (defun gnus-group-level (group) "Return the estimated level of GROUP." @@ -1881,7 +1875,7 @@ gnus-group-mark-group (if unmark (progn (setq gnus-group-marked (delete group gnus-group-marked)) - (insert-char ? 1 t)) + (insert-char ?\s 1 t)) (setq gnus-group-marked (cons group (delete group gnus-group-marked))) (insert-char gnus-process-mark 1 t))) @@ -2561,10 +2555,10 @@ gnus-group-goto-group (when group (let ((start (point)) (active (and (or - ;; some kind of group may be only there. - (gethash group gnus-active-hashtb) - ;; all groups (but with exception) are there. - (gethash group gnus-newsrc-hashtb)) + ;; Some kind of group may be only there. + (gnus-active group) + ;; All groups (but with exception) are there. + (gnus-group-entry group)) group))) (beginning-of-line) (cond @@ -4013,15 +4007,9 @@ gnus-group-list-active (gnus-agent gnus-plugged)); If we're actually plugged, store the active file in the agent. (gnus-read-active-file))) ;; Find all groups and sort them. - (let ((groups - (sort - (hash-table-keys gnus-active-hashtb) - 'string<)) - (buffer-read-only nil) - group) + (let ((buffer-read-only nil)) (erase-buffer) - (while groups - (setq group (pop groups)) + (dolist (group (sort (hash-table-keys gnus-active-hashtb) #'string<)) (add-text-properties (point) (prog1 (1+ (point)) (insert " *: " -- 2.20.1 --=-=-= Content-Type: text/plain While looking at bug#35208 and bug#35233, I spotted one more place in gnus-group.el which sets the gnus-group text property to the group's active info instead of its name, namely in gnus-group-prepare-flat-list-dead. Is the attached patch, which includes some extra cleanup, okay to push? Or have I misunderstood something? Thanks, -- Basil --=-=-=--