From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: Katsumi Yamaoka <yamaoka@jpl.org>
Cc: "Eric Abrahamsen" <eric@ericabrahamsen.net>,
"Bastien Guerry" <bzg@gnu.org>,
"Adam Sjøgren" <asjo@koldfront.dk>,
33653@debbugs.gnu.org
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 [thread overview]
Message-ID: <87wok0s024.fsf@tcd.ie> (raw)
In-Reply-To: <b4mwok9gdcz.fsf@jpl.org> (Katsumi Yamaoka's message of "Fri, 5 Apr 2019 15:44:44 +0900")
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-Always-set-gnus-group-property-to-a-group-name.patch --]
[-- Type: text/x-diff, Size: 7472 bytes --]
From 5d3eb57ae62decf6316ab7c882cc6f18a9c63ae3 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
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 <vinson@unagi.cis.upenn.edu>. 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
[-- Attachment #2: Type: text/plain, Size: 346 bytes --]
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
next prev parent reply other threads:[~2019-04-11 21:29 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-06 22:39 bug#33653: 27.0.50; Change Gnus obarrays-as-hash-tables into real hash tables Eric Abrahamsen
2018-12-06 22:46 ` Eric Abrahamsen
[not found] ` <m35zvzq34a.fsf@gnus.org>
2018-12-11 23:30 ` Eric Abrahamsen
2019-02-05 2:05 ` Eric Abrahamsen
2019-03-22 0:09 ` Eric Abrahamsen
2019-03-22 9:20 ` Robert Pluim
2019-03-22 17:21 ` Eric Abrahamsen
2019-03-22 19:54 ` Eric Abrahamsen
2019-03-22 21:07 ` Eli Zaretskii
2019-03-22 22:10 ` Eric Abrahamsen
2019-03-23 14:52 ` Andy Moreton
2019-03-23 16:14 ` Eric Abrahamsen
2019-03-26 18:28 ` Andy Moreton
2019-03-26 19:49 ` Eric Abrahamsen
2019-03-22 22:40 ` Glenn Morris
2019-03-22 22:51 ` Eric Abrahamsen
2019-03-23 6:46 ` Eli Zaretskii
2019-03-24 22:29 ` Bastien
2019-03-24 23:40 ` Eric Abrahamsen
2019-03-30 12:09 ` Deus Max
2019-03-31 23:27 ` Eric Abrahamsen
2019-04-01 22:39 ` Deus Max
2019-04-02 5:23 ` Eric Abrahamsen
2019-03-25 2:14 ` Katsumi Yamaoka
2019-03-25 2:35 ` Eric Abrahamsen
2019-03-25 14:45 ` Andy Moreton
2019-03-25 17:35 ` Eric Abrahamsen
2019-03-25 17:51 ` Robert Pluim
2019-03-25 18:17 ` Basil L. Contovounesios
2019-03-25 19:04 ` Bastien
2019-03-25 20:15 ` Andy Moreton
2019-03-26 19:58 ` Eric Abrahamsen
2019-03-26 21:44 ` Eric Abrahamsen
2019-03-27 4:54 ` Katsumi Yamaoka
2019-03-27 18:47 ` Eric Abrahamsen
2019-03-27 21:27 ` Eric Abrahamsen
2019-03-27 22:10 ` Eric Abrahamsen
2019-03-31 22:55 ` Eric Abrahamsen
2019-04-01 20:18 ` Adam Sjøgren
2019-04-01 20:57 ` Eric Abrahamsen
2019-04-02 16:43 ` Adam Sjøgren
2019-04-03 22:16 ` Katsumi Yamaoka
2019-04-03 22:36 ` Eric Abrahamsen
2019-04-05 4:25 ` Katsumi Yamaoka
2019-04-05 6:44 ` Katsumi Yamaoka
2019-04-05 11:02 ` Basil L. Contovounesios
2019-04-08 1:47 ` Katsumi Yamaoka
2019-04-05 20:18 ` Eric Abrahamsen
2019-04-08 1:58 ` Katsumi Yamaoka
2019-04-08 4:31 ` Katsumi Yamaoka
2019-04-11 21:29 ` Basil L. Contovounesios [this message]
2019-04-11 23:56 ` Katsumi Yamaoka
2019-04-12 11:05 ` Basil L. Contovounesios
2019-06-22 13:11 ` Lars Ingebrigtsen
2019-04-05 11:01 ` Basil L. Contovounesios
2019-04-08 8:13 ` Katsumi Yamaoka
2019-04-08 8:57 ` Andreas Schwab
2019-04-09 0:55 ` Katsumi Yamaoka
2019-04-08 18:31 ` Eric Abrahamsen
2019-04-09 0:55 ` Katsumi Yamaoka
2019-04-09 2:01 ` Eric Abrahamsen
2019-04-09 4:18 ` Katsumi Yamaoka
2019-04-09 4:30 ` Eric Abrahamsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wok0s024.fsf@tcd.ie \
--to=contovob@tcd.ie \
--cc=33653@debbugs.gnu.org \
--cc=asjo@koldfront.dk \
--cc=bzg@gnu.org \
--cc=eric@ericabrahamsen.net \
--cc=yamaoka@jpl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).