From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 25 12:14:35 2021 Received: (at submit) by debbugs.gnu.org; 25 Feb 2021 17:14:35 +0000 Received: from localhost ([127.0.0.1]:39117 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lFKDi-0003Iu-TE for submit@debbugs.gnu.org; Thu, 25 Feb 2021 12:14:35 -0500 Received: from lists.gnu.org ([209.51.188.17]:41788) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lFKDh-0003Im-5H for submit@debbugs.gnu.org; Thu, 25 Feb 2021 12:14:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFKDf-0003AG-UB for bug-gnu-emacs@gnu.org; Thu, 25 Feb 2021 12:14:32 -0500 Received: from smtp6-g21.free.fr ([212.27.42.6]:31746) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFKDd-0004fj-Uy for bug-gnu-emacs@gnu.org; Thu, 25 Feb 2021 12:14:31 -0500 Received: from ravel.localnet (unknown [90.118.181.206]) (Authenticated sender: ocert.dev@free.fr) by smtp6-g21.free.fr (Postfix) with ESMTPSA id 9B6B7780357 for ; Thu, 25 Feb 2021 18:14:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=free.fr; s=smtp-20201208; t=1614273266; bh=8NJJbYZoKP3sQ9oUr4uMr5gdEcVvTn9Q1zfG84el+Oc=; h=From:To:Subject:Date:From; b=tG7ktm07MdqSVES2mRAxNbQlMqL3qRpde5QiktW+rMVU6jNFTBVHeQfoZ56QXFZht hf1zVA9cFZ8RltHvTu+TT64wUO762RVx1mnwUbNbuqtsHo20oJFl4rJPixndJ5T427 QE5SI9A/u6kBxKuFH64hqVvd3Tiaee+RT6LanW0rb10vgTSGfPxKssdrok2hMN6TIK RKGuB2D/KfEwEeMANCMCG9sOIXdICiKc/jtgUo4KX7/5R+DNEy1HFjnT+ogTTUEocr MKDNdE987DmCXU09bJTfrAi4z1hCi9dmguEJMNZ0u1/SulykTGgXgSD7SEYVBz/9xp kQrIvRoOt/WUQ== From: Olivier Certner To: bug-gnu-emacs@gnu.org Subject: 27.1; ERC: Track: Modified channels doc and `erc-track-find-face' fixes Date: Thu, 25 Feb 2021 18:14:25 +0100 Message-ID: <3089116.bT80LyP3VS@ravel> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=212.27.42.6; envelope-from=ocert.dev@free.fr; helo=smtp6-g21.free.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) Several small documentation changes and one minor fix. List of (separate) changes: 1. Fix documentation of `erc-modified-channels-alist' about its structure. 2. Fix documentation of `erc-modified-channels-alist' about which channels it contains and when. Add references to docstring of `erc-make-mode-line-buffer- name'. 3. Rewrite `erc-track-find-face' to clarify what it does (& minor performance improvement; no functional changes). 4. `erc-track-modified-channels': Fix a perceived bug in the use of `erc- track-find-face' (changes mode line faces selection in some cases). URL and branch of the repository having the corresponding patches to be posted after the bug is open. Changes rebased on master. -- Olivier Certner From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 25 12:24:33 2021 Received: (at 46775) by debbugs.gnu.org; 25 Feb 2021 17:24:33 +0000 Received: from localhost ([127.0.0.1]:39149 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lFKNN-0005fb-FL for submit@debbugs.gnu.org; Thu, 25 Feb 2021 12:24:33 -0500 Received: from smtp6-g21.free.fr ([212.27.42.6]:34734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lFKNL-0005fT-8g for 46775@debbugs.gnu.org; Thu, 25 Feb 2021 12:24:32 -0500 Received: from ravel.localnet (unknown [90.118.181.206]) (Authenticated sender: ocert.dev@free.fr) by smtp6-g21.free.fr (Postfix) with ESMTPSA id DE255780326 for <46775@debbugs.gnu.org>; Thu, 25 Feb 2021 18:24:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=free.fr; s=smtp-20201208; t=1614273869; bh=cRcFdpEhdHXL+nX7Lvqsk4nMkwtEXl4OjSJEGLWS0ys=; h=From:To:Subject:Date:From; b=phQ/4Ff6vJ9zGFtUh8Fx/jQK6bBsUZdTRYZO5xJLOvtzbCPb5i2ZuAz+z0A+m5L+1 YK6x+uwizH4SeCzvWQh51pL0TvgYZwa1uov26cDIfPhNxtJ9/2VDEztRlrtpU0URy/ A46ejNoCJ7EH9TLy6dU8tLO4jC4J+Nskyq5VLzFO/JswjwstFCRbnvP20SDGivaBkk FtkQkK2QT2aDhDTIeZnyafEX/Jo5jwWR/AcYitTnYM7uaTZstqocJhlTgOzkbK+V0i XbdNBqv3ZIMx9R+l3rYHEoSmOs4wfV5lBe/w9RCSWFDRjBb109d9J6Ia2eBhRN6Lkc ZXLY5tIdrTU2g== From: Olivier Certner To: 46775@debbugs.gnu.org Subject: 27.1; ERC: Track: Modified channels doc and `erc-track-find-face' fixes Date: Thu, 25 Feb 2021 18:24:28 +0100 Message-ID: <2003028.4WAli8B44Z@ravel> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46775 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Pull request showing the commits: https://github.com/OlCe2/emacs/pull/1 From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 26 03:51:46 2021 Received: (at 46775) by debbugs.gnu.org; 26 Feb 2021 08:51:46 +0000 Received: from localhost ([127.0.0.1]:40271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lFYqg-0006jN-L3 for submit@debbugs.gnu.org; Fri, 26 Feb 2021 03:51:46 -0500 Received: from quimby.gnus.org ([95.216.78.240]:33972) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lFYqe-0006jA-J6 for 46775@debbugs.gnu.org; Fri, 26 Feb 2021 03:51:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=1BWL9fMBoGPPxNAIb2TazJImxUhLl/Y1x0koB5pFNS4=; b=aMFb9dtHiHzq4i5gbKtUcTHfry U+nRfxEc/oHLfUHzi1whMRkkX2QOKzSVONuFzzKKz2yRUBh9YNToJIcc5NGL2K8diA1s0HVmdNTro WVRp6SuTfRk+5v/lg0G078c+5gCU1TqVEq10KTkuR+N3pD+zl1mDNNrGUxQJez7nyLQ8=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lFYqM-0000Ta-O6; Fri, 26 Feb 2021 09:51:38 +0100 From: Lars Ingebrigtsen To: Olivier Certner Subject: Re: bug#46775: 27.1; ERC: Track: Modified channels doc and `erc-track-find-face' fixes References: <3089116.bT80LyP3VS@ravel> <2003028.4WAli8B44Z@ravel> X-Now-Playing: Oliver Cherer's _Sir Ollife Leigh & Other Ghosts + A Millying & Mor EP_: "Consider Darkness" Date: Fri, 26 Feb 2021 09:51:25 +0100 In-Reply-To: <2003028.4WAli8B44Z@ravel> (Olivier Certner's message of "Thu, 25 Feb 2021 18:24:28 +0100") Message-ID: <87czwnmctu.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Olivier Certner writes: > Pull request showing the commits: > https://github.com/OlCe2/emacs/pull/1 Can you post the patch here in the bug tracker? Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46775 Cc: 46775@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Olivier Certner writes: > Pull request showing the commits: > https://github.com/OlCe2/emacs/pull/1 Can you post the patch here in the bug tracker? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 26 04:03:31 2021 Received: (at 46775) by debbugs.gnu.org; 26 Feb 2021 09:03:31 +0000 Received: from localhost ([127.0.0.1]:40288 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lFZ22-00071p-IQ for submit@debbugs.gnu.org; Fri, 26 Feb 2021 04:03:31 -0500 Received: from smtp6-g21.free.fr ([212.27.42.6]:59202) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lFZ20-00071g-4K for 46775@debbugs.gnu.org; Fri, 26 Feb 2021 04:03:29 -0500 Received: from ravel.localnet (unknown [90.118.181.206]) (Authenticated sender: ocert.dev@free.fr) by smtp6-g21.free.fr (Postfix) with ESMTPSA id 91CC9780333; Fri, 26 Feb 2021 10:03:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=free.fr; s=smtp-20201208; t=1614330206; bh=9JG2NxPdixnNI0Qz7dk69T+QPDYFZbZqnAn9n2++jok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G8GqE2x7cMtiLJ1iuJUJzpnsPW3BLwomwAkvsxsNK1GjHXaHMhcEepm6KChW826J0 jWYoGJZglbrCSwxO76+4FBP3hX/gGF9uRk234nBUpjdOIOIb6pkTxzwTlDRqRTRNiV 6jyNcT8lv7XhEG4mKC8QLVgI5S3KQ986ATvTyEc6FOCRs++r/0opc5VYz5zqXxot3z sNP60IJU+o8OehM5l7hxZPti7jMfvOshBjDm47RPp21bXiA2YVMcboCVcrmMEUTZX1 t6h6s1cOmsRs2uUhAL8vJA0V1ueypEB42IBA4MhiZQ0xA/Ps7vDjZ52k+xlCSeA61z Oiqq3p28PUpgw== From: Olivier Certner To: Lars Ingebrigtsen Subject: Re: bug#46775: 27.1; ERC: Track: Modified channels doc and `erc-track-find-face' fixes Date: Fri, 26 Feb 2021 10:03:23 +0100 Message-ID: <1785172.CJpZife00y@ravel> In-Reply-To: <87czwnmctu.fsf@gnus.org> References: <3089116.bT80LyP3VS@ravel> <2003028.4WAli8B44Z@ravel> <87czwnmctu.fsf@gnus.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart3608439.DPmmpGpFb9" Content-Transfer-Encoding: 7Bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46775 Cc: 46775@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --nextPart3608439.DPmmpGpFb9 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" > Can you post the patch here in the bug tracker? Sure. Attached (there are 4 patches, hopefully making it easier to understand the changes). -- Olivier Certner --nextPart3608439.DPmmpGpFb9 Content-Disposition: attachment; filename="0001-ERC-Track-Fix-modified-channels-alist-s-documentatio.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-ERC-Track-Fix-modified-channels-alist-s-documentatio.patch" >From 868b042845211ced41cf751ac842e7d0b82da188 Mon Sep 17 00:00:00 2001 From: Olivier Certner Date: Wed, 13 Jan 2021 17:39:54 +0100 Subject: [PATCH 1/4] ERC: Track: Fix modified channels alist's documentation about its structure * lisp/erc/erc-track.el (erc-modified-channels-alist): Fix the docstring, which reports a proper list structure whereas it is a dotted list, where the last cdr is sometimes a proper list, making it sometimes a proper list. --- lisp/erc/erc-track.el | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index 56f66563ad..e53f7fb22d 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -280,14 +280,17 @@ nil - don't add to mode line." (defvar erc-modified-channels-alist nil "An ALIST used for tracking channel modification activity. -Each element looks like (BUFFER COUNT FACE) where BUFFER is a buffer -object of the channel the entry corresponds to, COUNT is a number -indicating how often activity was noticed, and FACE is the face to use -when displaying the buffer's name. See `erc-track-faces-priority-list', -and `erc-track-showcount'. +Each element is a list with form (BUFFER COUNT . FACE) where +BUFFER is a buffer object of the channel the entry corresponds +to, COUNT is a number indicating how often activity was noticed, +and FACE is a face (or a list of faces) to use when displaying the +buffer's name. Entries in this list should only happen for buffers where activity occurred -while the buffer was not visible.") +while the buffer was not visible. + +See also `erc-track-faces-priority-list', +`erc-track-faces-normal-list' and `erc-track-showcount'.") (defcustom erc-track-showcount nil "If non-nil, count of unseen messages will be shown for each channel." -- 2.30.0 --nextPart3608439.DPmmpGpFb9 Content-Disposition: attachment; filename="0002-ERC-Track-Clarify-documentation-on-tracked-buffers-a.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0002-ERC-Track-Clarify-documentation-on-tracked-buffers-a.patch" >From c3a0486a19e442d84596ce6b595b111afcd9b9d1 Mon Sep 17 00:00:00 2001 From: Olivier Certner Date: Thu, 14 Jan 2021 18:20:26 +0100 Subject: [PATCH 2/4] ERC: Track: Clarify documentation on tracked buffers and add references * lisp/erc/erc-track.el (erc-modified-channels-alist): Clarify what the list contains. Add references to variables and functions involved in displaying tracked buffers from this list. * lisp/erc/erc-track.el (erc-make-mode-line-buffer-name): Describe exactly the algorithm, and reference custom variables that influence it. --- lisp/erc/erc-track.el | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index e53f7fb22d..8b9f88ee2a 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -283,14 +283,19 @@ nil - don't add to mode line." Each element is a list with form (BUFFER COUNT . FACE) where BUFFER is a buffer object of the channel the entry corresponds to, COUNT is a number indicating how often activity was noticed, -and FACE is a face (or a list of faces) to use when displaying the -buffer's name. +and FACE is a face (or a list of faces, combined as usual) to use +when displaying the buffer's name in the mode line. -Entries in this list should only happen for buffers where activity occurred -while the buffer was not visible. +Entries in this list are only added/updated for buffers that were +not visible when activity occurred in them, and are removed for +each buffer as soon as it becomes visible again (or if the server +is disconnected, provided `erc-track-remove-disconnected-buffers' +is true). -See also `erc-track-faces-priority-list', -`erc-track-faces-normal-list' and `erc-track-showcount'.") +For how the face is chosen for a buffer, see +`erc-track-find-face' and `erc-track-priority-faces-only'. For +how buffers are then displayed in the mode line, see +`erc-modified-channels-display'.") (defcustom erc-track-showcount nil "If non-nil, count of unseen messages will be shown for each channel." @@ -652,8 +657,14 @@ ARGS are ignored." "The face to use when mouse is over channel names in the mode line.") (defun erc-make-mode-line-buffer-name (string buffer &optional faces count) - "Return STRING as a button that switches to BUFFER when clicked. -If FACES are provided, color STRING with them." + "Returns a button that switches to BUFFER when clicked. +STRING is the string in the button. It is possibly suffixed with +the number of unread messages, according to variables +`erc-track-showcount' and `erc-track-showcount-string'. + +If `erc-track-use-faces' is true and FACES are provided, format +STRING with them. When the mouse hovers above the button, STRING +is displayed according to `erc-track-mouse-face'." ;; We define a new sparse keymap every time, because 1. this data ;; structure is very small, the alternative would require us to ;; defvar a keymap, 2. the user is not interested in customizing it -- 2.30.0 --nextPart3608439.DPmmpGpFb9 Content-Disposition: attachment; filename="0003-ERC-Track-Rewrite-and-rename-erc-track-find-face.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0003-ERC-Track-Rewrite-and-rename-erc-track-find-face.patch" >From 548496c384ce115d92554604ab6ecc28e35ac190 Mon Sep 17 00:00:00 2001 From: Olivier Certner Date: Thu, 14 Jan 2021 18:26:38 +0100 Subject: [PATCH 3/4] ERC: Track: Rewrite and rename `erc-track-find-face' For clarification purposes. No functional changes. * lisp/erc/erc-track.el (erc-track-find-face): Rename it to `erc-track-select-face'. Rewrite it so that it is very clear what is the current algorithm, changing the parameters it takes. No functional changes. Performance improvements. Clarify the documentation and remove the part on some faces being lists, which clearly doesn't apply. * lisp/erc/erc-track.el (erc-track-modified-channels): Replace calls to `erc-track-find-face' by calls to `erc-track-select-face', preserving the existing behavior. * lisp/erc/erc-track.el (erc-modified-channels-alist): Change the reference to `erc-track-select-face' in the documentation following the rename. --- lisp/erc/erc-track.el | 81 ++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 35 deletions(-) diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index 8b9f88ee2a..d596685fee 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -293,7 +293,7 @@ is disconnected, provided `erc-track-remove-disconnected-buffers' is true). For how the face is chosen for a buffer, see -`erc-track-find-face' and `erc-track-priority-faces-only'. For +`erc-track-select-face' and `erc-track-priority-faces-only'. For how buffers are then displayed in the mode line, see `erc-modified-channels-display'.") @@ -760,38 +760,45 @@ Use `erc-make-mode-line-buffer-name' to create buttons." (when (called-interactively-p 'interactive) (erc-modified-channels-display))) -(defun erc-track-find-face (faces) - "Return the face to use in the mode line from the faces in FACES. -If `erc-track-faces-priority-list' is set, the one from FACES who -is first in that list will be used. If nothing matches or if -`erc-track-faces-priority-list' is not set, the default mode-line -faces will be used. +(defun erc-track-select-face (cur-face new-faces) + "Return the face to use in the mode line. -If `erc-track-faces-normal-list' is non-nil, use it to produce a -blinking effect that indicates channel activity when the first -element in FACES and the highest-ranking face among the rest of -FACES are both members of `erc-track-faces-normal-list'. +CUR-FACE is the face currently used in the mode line (for the +current buffer). NEW-FACES is the list of new faces that have +just been seen (in the current buffer). -If one of the faces is a list, then it will be ranked according -to its highest-tanking face member. A list of faces including -that member will take priority over just the single member -element." +Initially, the selected face is the one with highest priority in +`erc-track-faces-priority-list' (i.e., the one closest to the +head of the list) among CUR-FACE and NEW-FACES. If nothing +matches (including if `erc-track-faces-priority-list' is not +set), the default mode-line faces will be used (NIL is returned). + +If the selected face is still CUR-FACE (highest priority), and +the highest priority face in NEW-FACES alone is different (which +necessary means it has lower priority than CUR-FACE), and both +are in `erc-track-faces-normal-list', then the latter is selected +instead. This has the effect of allowing the current mode line +face, if a member of `erc-track-faces-normal-list', to be +replaced by another with lower priority from the new faces, if +that with highest priority in the new ones is also a member of +`erc-track-faces-normal-list'." (let ((choice (catch 'face - (dolist (candidate erc-track-faces-priority-list) - (when (member candidate faces) - (throw 'face candidate))))) - (no-first (and erc-track-faces-normal-list - (catch 'face - (dolist (candidate erc-track-faces-priority-list) - (when (member candidate (cdr faces)) - (throw 'face candidate))))))) - (cond ((null choice) - nil) - ((and (member choice erc-track-faces-normal-list) - (member no-first erc-track-faces-normal-list)) - no-first) - (t - choice)))) + (dolist (candidate erc-track-faces-priority-list) + (when (or (equal candidate cur-face) + (member candidate new-faces)) + (throw 'face candidate)))))) + (when choice + (if (and (equal choice cur-face) + (member choice erc-track-faces-normal-list)) + (let ((only-in-new + (catch 'face + (dolist (candidate erc-track-faces-priority-list) + (when (member candidate new-faces) + (throw 'face candidate)))))) + (if (member only-in-new erc-track-faces-normal-list) + only-in-new + choice)) + choice)))) (defun erc-track-modified-channels () "Hook function for `erc-insert-post-hook' to check if the current @@ -831,17 +838,21 @@ is in `erc-mode'." ;; Add buffer, faces and counts (setq erc-modified-channels-alist (cons (cons (current-buffer) - (cons 1 (erc-track-find-face faces))) + (cons 1 (erc-track-select-mode-line-face + (car faces) + (cdr faces)))) erc-modified-channels-alist)) ;; Else modify the face for the buffer, if necessary. (when faces (let* ((cell (assq (current-buffer) erc-modified-channels-alist)) (old-face (cddr cell)) - (new-face (erc-track-find-face - (if old-face - (cons old-face faces) - faces)))) + (new-face (if old-face + (erc-track-select-mode-line-face old-face + faces) + (erc-track-select-mode-line-face + (car faces) + (cdr faces))))) (setcdr cell (cons (1+ (cadr cell)) new-face))))) ;; And display it (erc-modified-channels-display))) -- 2.30.0 --nextPart3608439.DPmmpGpFb9 Content-Disposition: attachment; filename="0004-ERC-Track-Fix-a-perceived-minor-bug-in-mode-line-fac.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0004-ERC-Track-Fix-a-perceived-minor-bug-in-mode-line-fac.patch" >From e4de7a54136e72ed69c392c71fb57cf6e6a49d60 Mon Sep 17 00:00:00 2001 From: Olivier Certner Date: Thu, 14 Jan 2021 18:36:08 +0100 Subject: [PATCH 4/4] ERC: Track: Fix a perceived minor bug in mode line face selection * lisp/erc/erc-track.el (erc-track-modified-channels): Fix what is a probable bug when a new insert event happens for a buffer that was not tracked or for which no mode line face was selected: In this case, stop treating the latest buffer's face (first in list) as the previous one, which could be overriden with an older one (in FACES' rest), as if it had happened after. --- lisp/erc/erc-track.el | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index d596685fee..f0fa1fbed2 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -838,21 +838,14 @@ is in `erc-mode'." ;; Add buffer, faces and counts (setq erc-modified-channels-alist (cons (cons (current-buffer) - (cons 1 (erc-track-select-mode-line-face - (car faces) - (cdr faces)))) + (cons 1 (erc-track-select-face nil faces))) erc-modified-channels-alist)) ;; Else modify the face for the buffer, if necessary. (when faces (let* ((cell (assq (current-buffer) erc-modified-channels-alist)) (old-face (cddr cell)) - (new-face (if old-face - (erc-track-select-mode-line-face old-face - faces) - (erc-track-select-mode-line-face - (car faces) - (cdr faces))))) + (new-face (erc-track-select-face old-face faces))) (setcdr cell (cons (1+ (cadr cell)) new-face))))) ;; And display it (erc-modified-channels-display))) -- 2.30.0 --nextPart3608439.DPmmpGpFb9-- From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 26 04:23:45 2021 Received: (at control) by debbugs.gnu.org; 26 Feb 2021 09:23:45 +0000 Received: from localhost ([127.0.0.1]:40305 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lFZLd-0001AD-EL for submit@debbugs.gnu.org; Fri, 26 Feb 2021 04:23:45 -0500 Received: from quimby.gnus.org ([95.216.78.240]:34286) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lFZLb-00019o-Ud for control@debbugs.gnu.org; Fri, 26 Feb 2021 04:23:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=xx4iQJFQ26WJS6exETpE/ea314IzoLhzdUsEIHLI7SY=; b=vTAEt6ZkjlBKXs+4tfr8p+/ar9 rV90GzDsYVRSj1SHvBJNC+VUxHqyoNVKsvZ0ABA1wdsfnCq7U4dUxpxSc3sqh6/PqwpKwGTwSETFk eO55c9tsUAW3Y9AWyJPbe2+Kc0cUMZ75PqGUpaRDme31f8aHpSEfZq6NbNVtJayH0Tho=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lFZLU-0000hU-CP for control@debbugs.gnu.org; Fri, 26 Feb 2021 10:23:38 +0100 Date: Fri, 26 Feb 2021 10:23:35 +0100 Message-Id: <87zgzrkwrs.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #46775 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 46775 + patch quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 46775 + patch quit From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 09 09:07:28 2021 Received: (at 46775) by debbugs.gnu.org; 9 Jun 2021 13:07:28 +0000 Received: from localhost ([127.0.0.1]:60769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqxvb-0002DU-Vb for submit@debbugs.gnu.org; Wed, 09 Jun 2021 09:07:28 -0400 Received: from mail-109-mta143.mxroute.com ([136.175.109.143]:38475) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqxva-0002DH-MK for 46775@debbugs.gnu.org; Wed, 09 Jun 2021 09:07:27 -0400 Received: from filter004.mxroute.com ([149.28.56.236] filter004.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-109-mta143.mxroute.com (ZoneMTA) with ESMTPSA id 179f0e26696000774e.001 for <46775@debbugs.gnu.org> (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Wed, 09 Jun 2021 13:07:19 +0000 X-Zone-Loop: 9cc18d3a107a91ea601c14c59baeea153aa593ee6f05 X-Originating-IP: [149.28.56.236] From: "J.P." To: Olivier Certner Subject: Re: bug#46775: 27.1; ERC: Track: Modified channels doc and `erc-track-find-face' fixes References: <3089116.bT80LyP3VS@ravel> Date: Wed, 09 Jun 2021 06:07:17 -0700 In-Reply-To: <3089116.bT80LyP3VS@ravel> (Olivier Certner's message of "Thu, 25 Feb 2021 18:14:25 +0100") Message-ID: <877dj3xk3e.fsf@neverwas.me> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AuthUser: masked@neverwas.me X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46775 Cc: emacs-erc@gnu.org, 46775@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Olivier Certner writes: > Several small documentation changes and one minor fix. List of (separate) > changes: > 1. Fix documentation of `erc-modified-channels-alist' about its structure. > 2. Fix documentation of `erc-modified-channels-alist' about which channels it > contains and when. Add references to docstring of `erc-make-mode-line-buffer- > name'. The bit about the structure makes perfect sense, and the revised language is much clearer and easier to understand, at least to me. > 3. Rewrite `erc-track-find-face' to clarify what it does (& minor performance > improvement; no functional changes). The updates to the doc string here are likewise superb and make things crystal clear. Although sometimes, for drooling cretins like me, a unit test is worth a thousand words: way easier to take in the whole cause-and-effect of it all (push lever -> get pellet). Also, as a native EngRish speaker, I'm only 51% sure you meant s/necessary means/necessarily means/ in that last paragraph. In general though, I feel little optimizations like this are more than welcome because this stuff runs more or less constantly. > 4. `erc-track-modified-channels': Fix a perceived bug in the use of `erc- > track-find-face' (changes mode line faces selection in some cases). For this one, something like a detailed repro would be nice. But I suppose that's rather involved/tricky without fancier tooling. So I'll just take your word for it because (1) it sounds plausible and (2) you're way more familiar with this module than I. Regarding this module generally, it's definitely another one whose layout confuses me. For example, I guess we can't add keymaps to minor modes defined with `define-erc-module'? IOW, why the `erc-track-minor-mode-map' instead of a `erc-track-mode-map'? I'm also confused by the 001 RPL_WELCOME hook, but for now, I'll just assume it's a vestige of a simpler time when `erc-user-is-active' looked different and maybe did more. Or (more likely) there's something I'm not seeing just yet. Anyway, I mention this stuff because you may be the best/only qualified person to address such concerns at present. Would you be willing to audit this file for redundancy/cruft/obsolescence at some point before the next release? Thanks. From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 06 10:58:40 2021 Received: (at 46775) by debbugs.gnu.org; 6 Jul 2021 14:58:40 +0000 Received: from localhost ([127.0.0.1]:49673 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0mX1-0006xJ-Ln for submit@debbugs.gnu.org; Tue, 06 Jul 2021 10:58:40 -0400 Received: from smtp5-g21.free.fr ([212.27.42.5]:28826) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0lyo-0003sK-1h for 46775@debbugs.gnu.org; Tue, 06 Jul 2021 10:23:19 -0400 Received: from ravel.localnet (unknown [2.15.208.149]) (Authenticated sender: ocert.dev@free.fr) by smtp5-g21.free.fr (Postfix) with ESMTPSA id 787D5602C1 for <46775@debbugs.gnu.org>; Tue, 6 Jul 2021 16:23:15 +0200 (CEST) From: Olivier Certner To: 46775@debbugs.gnu.org Subject: Updated patches Date: Tue, 06 Jul 2021 16:23:14 +0200 Message-ID: <1862194.JH98yGZDhS@ravel> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart2331168.HzQftjyudI" Content-Transfer-Encoding: 7Bit X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 46775 X-Mailman-Approved-At: Tue, 06 Jul 2021 10:58:37 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) This is a multi-part message in MIME format. --nextPart2331168.HzQftjyudI Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" Patches slightly edited (commit message, doc text) and rebased on top of a recent 'master'. Ready to apply. Easy to backport to 27 as well. -- Olivier Certner --nextPart2331168.HzQftjyudI Content-Disposition: attachment; filename="0001-ERC-Track-Fix-modified-channels-alist-s-documentatio.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-ERC-Track-Fix-modified-channels-alist-s-documentatio.patch" >From ef79b97fedc46c5317dbb7104163f54335efa30f Mon Sep 17 00:00:00 2001 From: Olivier Certner Date: Wed, 13 Jan 2021 17:39:54 +0100 Subject: [PATCH 1/4] ERC: Track: Fix modified channels alist's documentation about its structure * lisp/erc/erc-track.el (erc-modified-channels-alist): Fix the docstring, which reports a proper list structure whereas it is a dotted list, where the last cdr is sometimes a proper list, making it sometimes a proper list. --- lisp/erc/erc-track.el | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index 2364d45d6f..bfaa3e5e72 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -262,14 +262,17 @@ erc-modified-channels-object (defvar erc-modified-channels-alist nil "An ALIST used for tracking channel modification activity. -Each element looks like (BUFFER COUNT FACE) where BUFFER is a buffer -object of the channel the entry corresponds to, COUNT is a number -indicating how often activity was noticed, and FACE is the face to use -when displaying the buffer's name. See `erc-track-faces-priority-list', -and `erc-track-showcount'. +Each element is a list with form (BUFFER COUNT . FACE) where +BUFFER is a buffer object of the channel the entry corresponds +to, COUNT is a number indicating how often activity was noticed, +and FACE is a face (or a list of faces) to use when displaying the +buffer's name. Entries in this list should only happen for buffers where activity occurred -while the buffer was not visible.") +while the buffer was not visible. + +See also `erc-track-faces-priority-list', +`erc-track-faces-normal-list' and `erc-track-showcount'.") (defcustom erc-track-showcount nil "If non-nil, count of unseen messages will be shown for each channel." -- 2.30.0 --nextPart2331168.HzQftjyudI Content-Disposition: attachment; filename="0002-ERC-Track-Clarify-documentation-on-tracked-buffers-a.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0002-ERC-Track-Clarify-documentation-on-tracked-buffers-a.patch" >From d51960947135ddbf479653c7e10845daa6f81162 Mon Sep 17 00:00:00 2001 From: Olivier Certner Date: Thu, 14 Jan 2021 18:20:26 +0100 Subject: [PATCH 2/4] ERC: Track: Clarify documentation on tracked buffers and add references * lisp/erc/erc-track.el (erc-modified-channels-alist): Clarify what the list contains. Add references to variables and functions involved in displaying tracked buffers from this list. * lisp/erc/erc-track.el (erc-make-mode-line-buffer-name): Describe exactly the algorithm, and reference custom variables that influence it. --- lisp/erc/erc-track.el | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index bfaa3e5e72..3e4e557d78 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -265,14 +265,19 @@ erc-modified-channels-alist Each element is a list with form (BUFFER COUNT . FACE) where BUFFER is a buffer object of the channel the entry corresponds to, COUNT is a number indicating how often activity was noticed, -and FACE is a face (or a list of faces) to use when displaying the -buffer's name. +and FACE is a face (or a list of faces, combined as usual) to use +when displaying the buffer's name in the mode line. -Entries in this list should only happen for buffers where activity occurred -while the buffer was not visible. +Entries in this list are only added/updated for buffers that were +not visible when activity occurred in them, and are removed for +each buffer as soon as it becomes visible again (or if the server +is disconnected, provided `erc-track-remove-disconnected-buffers' +is true). -See also `erc-track-faces-priority-list', -`erc-track-faces-normal-list' and `erc-track-showcount'.") +For how the face is chosen for a buffer, see +`erc-track-find-face' and `erc-track-priority-faces-only'. For +how buffers are then displayed in the mode line, see +`erc-modified-channels-display'.") (defcustom erc-track-showcount nil "If non-nil, count of unseen messages will be shown for each channel." @@ -625,8 +630,14 @@ erc-track-mouse-face "The face to use when mouse is over channel names in the mode line.") (defun erc-make-mode-line-buffer-name (string buffer &optional faces count) - "Return STRING as a button that switches to BUFFER when clicked. -If FACES are provided, color STRING with them." + "Returns a button that switches to BUFFER when clicked. +STRING is the string in the button. It is possibly suffixed with +the number of unread messages, according to variables +`erc-track-showcount' and `erc-track-showcount-string'. + +If `erc-track-use-faces' is true and FACES are provided, format +STRING with them. When the mouse hovers above the button, STRING +is displayed according to `erc-track-mouse-face'." ;; We define a new sparse keymap every time, because 1. this data ;; structure is very small, the alternative would require us to ;; defvar a keymap, 2. the user is not interested in customizing it -- 2.30.0 --nextPart2331168.HzQftjyudI Content-Disposition: attachment; filename="0003-ERC-Track-Rewrite-and-rename-erc-track-find-face.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0003-ERC-Track-Rewrite-and-rename-erc-track-find-face.patch" >From 10a98ca9505960b3bc21b6f965cb3184111f5e25 Mon Sep 17 00:00:00 2001 From: Olivier Certner Date: Thu, 14 Jan 2021 18:26:38 +0100 Subject: [PATCH 3/4] ERC: Track: Rewrite and rename `erc-track-find-face' For clarification purposes. No functional changes. * lisp/erc/erc-track.el (erc-track-find-face): Rename it to `erc-track-select-face'. Rewrite it so that it is very clear what is the current algorithm, changing the parameters it takes. No functional changes. Performance improvements. Clarify the documentation and remove the part on some faces being lists, which clearly doesn't apply. * lisp/erc/erc-track.el (erc-track-modified-channels): Replace calls to `erc-track-find-face' by calls to `erc-track-select-face', preserving the existing behavior. * lisp/erc/erc-track.el (erc-modified-channels-alist): Change the reference to `erc-track-select-face' in the documentation following the rename. --- lisp/erc/erc-track.el | 81 ++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 35 deletions(-) diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index 3e4e557d78..d63028cfeb 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -275,7 +275,7 @@ erc-modified-channels-alist is true). For how the face is chosen for a buffer, see -`erc-track-find-face' and `erc-track-priority-faces-only'. For +`erc-track-select-face' and `erc-track-priority-faces-only'. For how buffers are then displayed in the mode line, see `erc-modified-channels-display'.") @@ -733,38 +733,45 @@ erc-modified-channels-remove-buffer (when (called-interactively-p 'interactive) (erc-modified-channels-display))) -(defun erc-track-find-face (faces) - "Return the face to use in the mode line from the faces in FACES. -If `erc-track-faces-priority-list' is set, the one from FACES who -is first in that list will be used. If nothing matches or if -`erc-track-faces-priority-list' is not set, the default mode-line -faces will be used. +(defun erc-track-select-face (cur-face new-faces) + "Return the face to use in the mode line. -If `erc-track-faces-normal-list' is non-nil, use it to produce a -blinking effect that indicates channel activity when the first -element in FACES and the highest-ranking face among the rest of -FACES are both members of `erc-track-faces-normal-list'. +CUR-FACE is the face currently used in the mode line (for the +current buffer). NEW-FACES is the list of new faces that have +just been seen (in the current buffer). -If one of the faces is a list, then it will be ranked according -to its highest-tanking face member. A list of faces including -that member will take priority over just the single member -element." +Initially, the selected face is the one with highest priority in +`erc-track-faces-priority-list' (i.e., the one closest to the +head of the list) among CUR-FACE and NEW-FACES. If nothing +matches (including if `erc-track-faces-priority-list' is not +set), the default mode-line faces will be used (NIL is returned). + +If the selected face is still CUR-FACE (highest priority), and +the highest priority face in NEW-FACES alone is different (which +necessarily means it has lower priority than CUR-FACE), and both +are in `erc-track-faces-normal-list', then the latter is selected +instead. This has the effect of allowing the current mode line +face, if a member of `erc-track-faces-normal-list', to be +replaced by another with lower priority from the new faces, if +that with highest priority in the new ones is also a member of +`erc-track-faces-normal-list'." (let ((choice (catch 'face - (dolist (candidate erc-track-faces-priority-list) - (when (member candidate faces) - (throw 'face candidate))))) - (no-first (and erc-track-faces-normal-list - (catch 'face - (dolist (candidate erc-track-faces-priority-list) - (when (member candidate (cdr faces)) - (throw 'face candidate))))))) - (cond ((null choice) - nil) - ((and (member choice erc-track-faces-normal-list) - (member no-first erc-track-faces-normal-list)) - no-first) - (t - choice)))) + (dolist (candidate erc-track-faces-priority-list) + (when (or (equal candidate cur-face) + (member candidate new-faces)) + (throw 'face candidate)))))) + (when choice + (if (and (equal choice cur-face) + (member choice erc-track-faces-normal-list)) + (let ((only-in-new + (catch 'face + (dolist (candidate erc-track-faces-priority-list) + (when (member candidate new-faces) + (throw 'face candidate)))))) + (if (member only-in-new erc-track-faces-normal-list) + only-in-new + choice)) + choice)))) (defun erc-track-modified-channels () "Hook function for `erc-insert-post-hook' to check if the current @@ -804,17 +811,21 @@ erc-track-modified-channels ;; Add buffer, faces and counts (setq erc-modified-channels-alist (cons (cons (current-buffer) - (cons 1 (erc-track-find-face faces))) + (cons 1 (erc-track-select-mode-line-face + (car faces) + (cdr faces)))) erc-modified-channels-alist)) ;; Else modify the face for the buffer, if necessary. (when faces (let* ((cell (assq (current-buffer) erc-modified-channels-alist)) (old-face (cddr cell)) - (new-face (erc-track-find-face - (if old-face - (cons old-face faces) - faces)))) + (new-face (if old-face + (erc-track-select-mode-line-face old-face + faces) + (erc-track-select-mode-line-face + (car faces) + (cdr faces))))) (setcdr cell (cons (1+ (cadr cell)) new-face))))) ;; And display it (erc-modified-channels-display))) -- 2.30.0 --nextPart2331168.HzQftjyudI Content-Disposition: attachment; filename="0004-ERC-Track-Fix-a-perceived-minor-bug-in-mode-line-fac.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0004-ERC-Track-Fix-a-perceived-minor-bug-in-mode-line-fac.patch" >From 1d4abfa935b1a5f5eb0c6ff7b3c82ebb46747653 Mon Sep 17 00:00:00 2001 From: Olivier Certner Date: Thu, 14 Jan 2021 18:36:08 +0100 Subject: [PATCH 4/4] ERC: Track: Fix a perceived minor bug in mode line face selection * lisp/erc/erc-track.el (erc-track-modified-channels): Fix what is a probable bug when a new insert event happens for a buffer that was not tracked or for which no mode line face was selected: In this case, stop treating the latest buffer's face (first in list) as the previous one, which could be overriden with an older one (in FACES' rest), as if it had happened after. --- lisp/erc/erc-track.el | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index d63028cfeb..e9bc77dea0 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -811,21 +811,14 @@ erc-track-modified-channels ;; Add buffer, faces and counts (setq erc-modified-channels-alist (cons (cons (current-buffer) - (cons 1 (erc-track-select-mode-line-face - (car faces) - (cdr faces)))) + (cons 1 (erc-track-select-face nil faces))) erc-modified-channels-alist)) ;; Else modify the face for the buffer, if necessary. (when faces (let* ((cell (assq (current-buffer) erc-modified-channels-alist)) (old-face (cddr cell)) - (new-face (if old-face - (erc-track-select-mode-line-face old-face - faces) - (erc-track-select-mode-line-face - (car faces) - (cdr faces))))) + (new-face (erc-track-select-face old-face faces))) (setcdr cell (cons (1+ (cadr cell)) new-face))))) ;; And display it (erc-modified-channels-display))) -- 2.30.0 --nextPart2331168.HzQftjyudI-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 06 12:34:57 2021 Received: (at 46775) by debbugs.gnu.org; 6 Jul 2021 16:34:57 +0000 Received: from localhost ([127.0.0.1]:49891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0o2C-0003iM-TJ for submit@debbugs.gnu.org; Tue, 06 Jul 2021 12:34:57 -0400 Received: from smtp5-g21.free.fr ([212.27.42.5]:12674) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0o2B-0003iE-9a for 46775@debbugs.gnu.org; Tue, 06 Jul 2021 12:34:56 -0400 Received: from ravel.localnet (unknown [2.15.208.149]) (Authenticated sender: ocert.dev@free.fr) by smtp5-g21.free.fr (Postfix) with ESMTPSA id 9C1BE60174; Tue, 6 Jul 2021 18:34:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=free.fr; s=smtp-20201208; t=1625589293; bh=8BSACIhNp76w7DpsXJiBKzSJgmrboDadNVGPHb0MlNg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ab0tq8ftbpqu6S2796AuKZa5S9ze8MMVe6LZ1t9oxfoqKrl5dWf6WFayR9dfFwfNg mpWGdnzLLsZ8i5NRH/a3xw0NIhIbXhatrflCp5i1DuPnvirREehL8y/qe/GXK31+6F tWAuP9t9Q3Q04ZiULhzsZXwpDLwG4Fsnl3I4XyirRPiUD7WMmjKHiUgsshpOMwTJoj OLyCWYmZUUIAmfYiMOM0XjbLeWqjzRXBKsBo6j6ccdY46d2aYfkzQUSNyYG92DhfvW rvcEOBwq5tzrxkCfz5crs24ba0/lch9p/LQqF+Cl2ZswAmL1I5VNCRLeeLgdivnN5x 2T7Y0fs3DwtMg== From: Olivier Certner To: "J.P." Subject: Re: bug#46775: 27.1; ERC: Track: Modified channels doc and `erc-track-find-face' fixes Date: Tue, 06 Jul 2021 18:34:48 +0200 Message-ID: <2016416.4WAli8B44Z@ravel> In-Reply-To: <877dj3xk3e.fsf@neverwas.me> References: <3089116.bT80LyP3VS@ravel> <877dj3xk3e.fsf@neverwas.me> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46775 Cc: emacs-erc@gnu.org, 46775@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > The updates to the doc string here are likewise superb and make things > crystal clear. Thanks! > only 51% sure you meant s/necessary means/necessarily means/ in that I fixed the typo in the updated patch. > Regarding this module generally, it's definitely another one whose > layout confuses me. For example, I guess we can't add keymaps to minor > modes defined with `define-erc-module'? IOW, why the > `erc-track-minor-mode-map' instead of a `erc-track-mode-map'? The trick is that `erc-track-minor-mode' may be enabled or disabled independently of the whole module. In particular, it may not be activated at all if the (global) keybindings it wants to install, which don't abide by the rules for minor modes maps, are already bound at the time of module's activation. > I'm also confused by the 001 RPL_WELCOME hook, but for now, I'll just assume > it's a vestige of a simpler time when `erc-user-is-active' looked different > and maybe did more. Or (more likely) there's something I'm not seeing > just yet. `erc-user-is-active' seems in fact to be used for more than one purpose. In particular, it also triggers an update of channels in the mode line. What's exactly the problem with hooking on 001? > Anyway, I mention this stuff because you may be the best/only > qualified person to address such concerns at present. Would you be > willing to audit this file for redundancy/cruft/obsolescence at some > point before the next release? Thanks. Depending on available time and precise concerns that you may have, yes. There is a lot of room for improvement in this module. In particular in determining how some user is "active" (none of the current possibilities really suits my needs). -- Olivier Certner From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 07 08:30:56 2021 Received: (at 46775) by debbugs.gnu.org; 7 Jul 2021 12:30:56 +0000 Received: from localhost ([127.0.0.1]:51078 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m16hb-0005G7-O3 for submit@debbugs.gnu.org; Wed, 07 Jul 2021 08:30:55 -0400 Received: from mail-108-mta226.mxroute.com ([136.175.108.226]:40953) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m16hZ-0005Fr-Fk for 46775@debbugs.gnu.org; Wed, 07 Jul 2021 08:30:53 -0400 Received: from filter004.mxroute.com ([149.28.56.236] filter004.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta226.mxroute.com (ZoneMTA) with ESMTPSA id 17a80f2f8c7000ae11.001 for <46775@debbugs.gnu.org> (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Wed, 07 Jul 2021 12:30:44 +0000 X-Zone-Loop: db45c3eba4322792375138c5a8604214e358dca07f8c X-Originating-IP: [149.28.56.236] From: "J.P." To: Olivier Certner Subject: Re: bug#46775: 27.1; ERC: Track: Modified channels doc and `erc-track-find-face' fixes References: <3089116.bT80LyP3VS@ravel> <877dj3xk3e.fsf@neverwas.me> <2016416.4WAli8B44Z@ravel> Date: Wed, 07 Jul 2021 05:30:41 -0700 In-Reply-To: <2016416.4WAli8B44Z@ravel> (Olivier Certner's message of "Tue, 06 Jul 2021 18:34:48 +0200") Message-ID: <87tul671ce.fsf@neverwas.me> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AuthUser: masked@neverwas.me X-Zone-Spam-Resolution: no action X-Zone-Spam-Status: No, score=-0.1, required=15, tests=[ARC_NA=0, FROM_HAS_DN=0, RCPT_COUNT_THREE=0, TO_DN_SOME=0, FREEMAIL_TO=0, MIME_GOOD=-0.1, FROM_EQ_ENVFROM=0, MIME_TRACE=0, RCVD_COUNT_ZERO=0, FREEMAIL_ENVRCPT=0, MID_RHS_MATCH_FROM=0, NEURAL_SPAM=0] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46775 Cc: emacs-erc@gnu.org, 46775@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Olivier Certner writes: > The trick is that `erc-track-minor-mode' may be enabled or disabled > independently of the whole module. In particular, it may not be activated at > all if the (global) keybindings it wants to install, which don't abide by the > rules for minor modes maps, are already bound at the time of module's > activation. Right, thanks for patiently explaining an RTFM-worthy question. So like the doc string says: "for the sole purpose of providing the C-c C-SPC and C-c C-@ keybindings" (basically for toggling during sessions). I guess I was dazed into a stupor by encountering two global minor modes for the same module with only the word "-minor" to distinguish them. Anyway, it's obviously decades too late to reconsider modules doubling as minor modes. But perhaps it's still worth reexamining `erc-update-modules' at some point. As a quick aside: Currently, we rely on a module's options for conveying per-connection specifics, when supported. Some options, like `erc-enable-logging', are buffer local but require extra attention to exploit on a per-connection basis. And while the macro `erc-define-module' does have a `local-p' param, I don't think it's actually being used anywhere. This is probably in part due to `erc-update-modules' only ever enabling (and never disabling) modules and also running just a hair too early, i.e., right before a new ERC buffer is made current. Perhaps a discussion dedicated to this topic may be beneficial at some point. > `erc-user-is-active' seems in fact to be used for more than one purpose. In > particular, it also triggers an update of channels in the mode line. What's > exactly the problem with hooking on 001? The 001 hook only runs in server buffers. And when it does, `erc-server-connected' is always nil. > There is a lot of room for improvement in this module. In particular in > determining how some user is "active" (none of the current possibilities > really suits my needs). Then hopefully we can (eventually) make it smarter. I get the feeling this module, when fully realized, might provide an experience that's actually superior to that offered by dedicated clients. From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 12 01:25:40 2021 Received: (at 46775-done) by debbugs.gnu.org; 12 Sep 2021 05:25:40 +0000 Received: from localhost ([127.0.0.1]:41859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPHzo-0000jn-B9 for submit@debbugs.gnu.org; Sun, 12 Sep 2021 01:25:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59170) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPHzm-0000jb-F5 for 46775-done@debbugs.gnu.org; Sun, 12 Sep 2021 01:25:39 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51276) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPHzg-0006y4-Jj; Sun, 12 Sep 2021 01:25:32 -0400 Received: from [2607:fea8:3fdf:f2d9:68d7:5e29:cc3b:70fd] (port=58454 helo=langa) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPHzb-0004dz-Pc; Sun, 12 Sep 2021 01:25:32 -0400 From: Amin Bandali To: Olivier Certner Subject: Re: bug#46775: 27.1; ERC: Track: Modified channels doc and `erc-track-find-face' fixes References: <3089116.bT80LyP3VS@ravel> <1862194.JH98yGZDhS@ravel> Date: Sun, 12 Sep 2021 01:25:19 -0400 In-Reply-To: <1862194.JH98yGZDhS@ravel> Message-ID: <87tuiqwekg.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 46775-done Cc: 46775-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Olivier, Many thanks for your patches, and my apologies it's taken so long to get them merged. Olivier Certner writes: > Patches slightly edited (commit message, doc text) and rebased on top of a > recent 'master'. Ready to apply. Easy to backport to 27 as well. I applied (1) and (2) to 'emacs-27' and then merged that into 'master', then applied (3) and (4) on 'master'; each with a few small tweaks. Thanks again, amin From unknown Sun Aug 10 09:14:54 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 10 Oct 2021 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator