From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Amin Bandali Newsgroups: gmane.emacs.bugs Subject: bug#44100: Patch Date: Sat, 31 Oct 2020 22:16:54 -0400 Organization: GNU Message-ID: <875z6pu8h5.fsf__36077.5105351181$1604197093$gmane$org@gnu.org> References: <4578382.cRamKGfW39@ravel> <21986473.sr7ieKrsik@ravel> <87imaquq6z.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1562"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-erc@gnu.org, 44100@debbugs.gnu.org, Olivier Certner To: Corwin Brust Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 01 03:18:09 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kZ2wa-0000Hv-Uk for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Nov 2020 03:18:09 +0100 Original-Received: from localhost ([::1]:46798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZ2wa-00036r-0d for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 31 Oct 2020 22:18:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZ2wU-00036j-Dz for bug-gnu-emacs@gnu.org; Sat, 31 Oct 2020 22:18:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kZ2wU-0005rt-4x for bug-gnu-emacs@gnu.org; Sat, 31 Oct 2020 22:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kZ2wT-0008MD-VL for bug-gnu-emacs@gnu.org; Sat, 31 Oct 2020 22:18:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Amin Bandali Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Nov 2020 02:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44100 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 44100-submit@debbugs.gnu.org id=B44100.160419702632055 (code B ref 44100); Sun, 01 Nov 2020 02:18:01 +0000 Original-Received: (at 44100) by debbugs.gnu.org; 1 Nov 2020 02:17:06 +0000 Original-Received: from localhost ([127.0.0.1]:35167 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZ2va-0008Kv-1j for submit@debbugs.gnu.org; Sat, 31 Oct 2020 22:17:06 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:58246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZ2vW-0008KL-IT for 44100@debbugs.gnu.org; Sat, 31 Oct 2020 22:17:05 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:47003) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZ2vQ-0005nZ-CY; Sat, 31 Oct 2020 22:16:56 -0400 Original-Received: from [2607:fea8:3fdf:f688:6557:fc41:50c6:42] (port=40338 helo=localhost) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kZ2vP-0001PG-Tm; Sat, 31 Oct 2020 22:16:56 -0400 In-Reply-To: <87imaquq6z.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:192325 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Hello again, I did some more investigation, and was able to reproduce the issue. However, I came up with a potentially more proper different fix: I think the presence of the dotted pair with a non-nil cdr is the main problem, since it means `erc-modified-channels-alist' does not fully adhere to the documented structure in its docstring. So I addressed the issue in `erc-track-modified-channels' by wrapping up single faces in lists too, ensuring that `erc-modified-channels-alist' never ends in a non-nil cdr. Something along the lines of the following patch. Thoughts? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Maintain-the-documented-structure-for-erc-modified-c.patch Content-Transfer-Encoding: quoted-printable From=209cccb6b00fea837c9d28305db30b21353134b990 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Sat, 31 Oct 2020 21:41:38 -0400 Subject: [PATCH] Maintain the documented structure for 'erc-modified-channels-alist' * lisp/erc/erc-track.el (erc-track-modified-channels): Wrap the single face in a list to avoid a non-nil final cdr in `erc-modified-channels-alist', making its value adhere more closely to its stated structure in its docstring. Also unbreaks erc-ibuffer. * lisp/erc/erc-status-sidebar.el (erc-status-sidebar-default-chan-format): Account for the change in structure of `erc-modified-channels-alist' due to this fix. =2D-- lisp/erc/erc-status-sidebar.el | 2 +- lisp/erc/erc-track.el | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lisp/erc/erc-status-sidebar.el b/lisp/erc/erc-status-sidebar.el index 08dc8d6015..4fc9b4fc30 100644 =2D-- a/lisp/erc/erc-status-sidebar.el +++ b/lisp/erc/erc-status-sidebar.el @@ -191,7 +191,7 @@ erc-status-sidebar-default-chan-format (setq channame (format "%s [%d]" channame num-messages))) (when erc-face (put-text-property 0 (length channame) 'face erc-face channame) =2D (when (eq erc-face 'erc-default-face) + (when (eq (car erc-face) 'erc-default-face) (add-face-text-property 0 (length channame) 'bold t channame))) channame) =20 diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index 60f0cfa942..3618df6568 100644 =2D-- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -815,10 +815,13 @@ erc-track-modified-channels (throw 'found t)))))) (if (not (assq (current-buffer) erc-modified-channels-alist)) ;; Add buffer, faces and counts =2D (setq erc-modified-channels-alist =2D (cons (cons (current-buffer) =2D (cons 1 (erc-track-find-face faces))) =2D erc-modified-channels-alist)) + (let ((new-face (erc-track-find-face faces))) + (setq erc-modified-channels-alist + (cons (cons (current-buffer) + (cons 1 (if (listp new-face) + new-face + (list new-face)))) + erc-modified-channels-alist))) ;; Else modify the face for the buffer, if necessary. (when faces (let* ((cell (assq (current-buffer) @@ -828,7 +831,10 @@ erc-track-modified-channels (if old-face (cons old-face faces) faces)))) =2D (setcdr cell (cons (1+ (cadr cell)) new-face))))) + (setcdr cell (cons (1+ (cadr cell)) + (if (listp new-face) + new-face + (list new-face))))))) ;; And display it (erc-modified-channels-display))) ;; Else if the active buffer is the current buffer, remove it @@ -863,7 +869,7 @@ erc-track-last-non-erc-buffer `erc-track-switch-buffer'.") =20 (defun erc-track-sort-by-activest () =2D "Sort erc-modified-channels-alist by activity. + "Sort `erc-modified-channels-alist' by activity. That means the number of unseen messages in a channel." (setq erc-modified-channels-alist (sort erc-modified-channels-alist =2D-=20 2.17.1 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJEBAEBCgAuFiEEObM8jZRIDS3cwqSYi0Sgzce5VvIFAl+eGpYQHGJhbmRhbGlA Z251Lm9yZwAKCRCLRKDNx7lW8nt0D/wIAUelkBs1ph894KrnvO9zT8NP0Z0/qDEP xl6y3fcSTnfSNZgjAhqlwBkbUsLDQjHKIfV5FgHdulW/75YcGdLrKzqOl3UmO5hR xZIjRgSAdkPPY3+oyDreItumS9iK0hOz0xGE78JWGWUvU4JtbD8xECygXSabSn/k GZcpPeoSdQKUFRJggtsqxvLu6fIWBz35Sb44Uh5xJYZ42CIXce8U4KhiLNuwOWMD Hp1HCKtAfxPubzVB0R682xdlcNy34r+8VipqgwWlnnl33TJHk+IFP0wCLL0hs03B 6Y8hHCNewpIH6lSEZVIlpBYDHt7MathjrotJp5ayNkloSFG4lLsXZcmBL3RcoY8c IqR1whWtWT6O1zqmqjvmY/3v1jZPFQX0ri6X/a4599vwyrL6qeyhpZ5uNAmgxN7K Wdj0cQz0RPNe5PMyOaFfJcE7lhLvPkA6I058hT+1cfbRXPYYTitZbqtWgRRgxGiZ Y3c6b7aKjdX1ciUPnugooeX3rZ0ViMsLeA4RPYYh19K2N7H6qfArb9WrP9xmp4U7 tXlKseT+8YJh2Nnq7sjLhlNPWKKmyz36enxMbCApQR0u/Ja0n1/ZIi3De8hZmTF0 EpYumv83LO36pPcolkIN3f+/ESRsZcOJ3glOWq2L2YcggBjsdxjMFjWTZEsHMRVi aBhqHq1CIw== =zaE8 -----END PGP SIGNATURE----- --==-=-=--