From: F. Jason Park Date: Mon, 25 Sep 2023 13:06:13 +0000 (-0700) Subject: Fix wrong "User" column count in erc-ibuffer X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ffd5d2f38d3bf521aa97e22cb134bc687429f01b;p=emacs.git Fix wrong "User" column count in erc-ibuffer (ibuffer-make-column-erc-members): Show tally of all server users for non-target buffers, and show correct count for targets. Thanks to Mattias EngdegÄrd for reporting this. (erc-ibuffer-limit-map): Use "new" `define-ibuffer-filter' API. (Bug#66191) --- diff --git a/lisp/erc/erc-ibuffer.el b/lisp/erc/erc-ibuffer.el index 612814ac6da..790efae97ac 100644 --- a/lisp/erc/erc-ibuffer.el +++ b/lisp/erc/erc-ibuffer.el @@ -27,6 +27,9 @@ ;; needs work. Usage: Type / C-e C-h when in Ibuffer-mode to see new ;; limiting commands +;; This library does not contain a module, but you can `require' it +;; after loading `erc' to make use of its functionality. + ;;; Code: (require 'ibuffer) @@ -118,11 +121,11 @@ (define-ibuffer-column erc-members (:name "Users") - (if (and (eq major-mode 'erc-mode) - (boundp 'erc-channel-users) - (hash-table-p erc-channel-users) - (> (hash-table-size erc-channel-users) 0)) - (number-to-string (hash-table-size erc-channel-users)) + (if-let ((table (or erc-channel-users erc-server-users)) + ((hash-table-p table)) + (count (hash-table-count table)) + ((> count 0))) + (number-to-string count) "")) (define-ibuffer-column erc-away (:name "A") @@ -177,8 +180,7 @@ (defvar erc-ibuffer-limit-map nil "Prefix keymap to use for ERC related limiting.") (define-prefix-command 'erc-ibuffer-limit-map) -;; FIXME: Where is `ibuffer-limit-by-erc-server' defined? -(define-key 'erc-ibuffer-limit-map (kbd "s") 'ibuffer-limit-by-erc-server) +(define-key 'erc-ibuffer-limit-map (kbd "s") #'ibuffer-filter-by-erc-server) (define-key ibuffer-mode-map (kbd "/ \C-e") 'erc-ibuffer-limit-map) (provide 'erc-ibuffer)