From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Amin Bandali Newsgroups: gmane.emacs.bugs Subject: bug#36843: 26.2; ERC lurker feature broken Date: Tue, 27 Aug 2019 10:31:00 -0400 Message-ID: <877e6y7k9n.fsf@fencepost.gnu.org> References: <877e80o5tb.fsf@thb.lt> <87v9uvmyib.fsf@gnu.org> <871rxao6lc.fsf@gmail.com> 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="162577"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: Thibault Polge , 36843@debbugs.gnu.org To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 27 16:32:18 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.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i2cW8-000g4v-0h for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Aug 2019 16:32:16 +0200 Original-Received: from localhost ([::1]:52070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2cW6-0001ZZ-Un for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Aug 2019 10:32:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41397) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2cVv-0001Xz-VD for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2019 10:32:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i2cVu-0001we-JK for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2019 10:32:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40425) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i2cVu-0001wa-Es for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2019 10:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i2cVu-0006cb-AJ for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2019 10:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Amin Bandali Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Aug 2019 14:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36843 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 36843-submit@debbugs.gnu.org id=B36843.156691627525389 (code B ref 36843); Tue, 27 Aug 2019 14:32:02 +0000 Original-Received: (at 36843) by debbugs.gnu.org; 27 Aug 2019 14:31:15 +0000 Original-Received: from localhost ([127.0.0.1]:49246 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i2cV9-0006bR-8E for submit@debbugs.gnu.org; Tue, 27 Aug 2019 10:31:15 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:60973) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i2cV7-0006bD-CA for 36843@debbugs.gnu.org; Tue, 27 Aug 2019 10:31:13 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:59491) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1i2cUw-0001bn-Jm; Tue, 27 Aug 2019 10:31:03 -0400 Original-Received: from [2607:fea8:3b80:184:5488:d652:cee4:415c] (port=32988 helo=localhost) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1i2cUw-0004TT-8N; Tue, 27 Aug 2019 10:31:02 -0400 In-Reply-To: <871rxao6lc.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:165963 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Noam Postavsky writes: > Amin Bandali writes: > >> From: Amin Bandali > > This address seems to be different than what's in the copyright list. > Could you use that one, since otherwise it's a bit confusing as to > whether I'm actually looking at the entry of the right person. > Thanks for bringing this to my attention. I=E2=80=99d changed my email bac= k in December 2018 and had notified the copyright clerk about it, but it seems that their change hadn=E2=80=99t properly propagated to copyright.lis= t. It should be there now. > >> Date: Sat, 17 Aug 2019 14:09:11 -0400 >> Subject: [PATCH] Fix erc-lurker-update-status >> >> Fix erc-lurker-update-status (bug#36843), broken since >> d0fcaff514d2be16ccf73817f658318cf85221e3. >> >> * lisp/erc/erc.el: define `erc-message-parsed', lexically bind it in > > Instead of "lexically" I believe you actually mean "dynamically" > (binding lexically is the cause of the bug). And I would reformat like > this: > Good catch! I rebased on latest master and reformatted per your suggestion. I=E2=80=99ve attached an updated patch below. Thanks for your feedback. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-erc-lurker-update-status-bug-36843.patch >From 2bc8f35e4a0f76e7b59950738fbfdc3c3e48263c Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Sat, 17 Aug 2019 14:09:11 -0400 Subject: [PATCH] Fix erc-lurker-update-status (bug#36843) Broken since 2013-08-22 "* lisp/erc/erc.el: Use lexical-binding". * lisp/erc/erc.el (erc-message-parsed): New variable. (erc-display-message): Dynamically bind it. (erc-lurker-update-status): Check it instead of using `parsed' directly. This results in `erc-lurker-state' being properly updated to keep track of non-lurkers, and thus `erc-lurker-p' returning correct results rather than return t for everyone. --- lisp/erc/erc.el | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index f5c9decc3a..9ea9e608ac 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -2594,6 +2594,8 @@ erc-lurker-cleanup-interval consumption of lurker state during long Emacs sessions and/or ERC sessions with large numbers of incoming PRIVMSGs.") +(defvar erc-message-parsed) + (defun erc-lurker-update-status (_message) "Update `erc-lurker-state' if necessary. @@ -2603,18 +2605,20 @@ erc-lurker-update-status current time. Otherwise, take no action. This function depends on the fact that `erc-display-message' -dynamically binds `parsed', which is used to check if the current -message is a PRIVMSG and to determine its sender. See also -`erc-lurker-trim-nicks' and `erc-lurker-ignore-chars'. +dynamically binds `erc-message-parsed', which is used to check if +the current message is a PRIVMSG and to determine its sender. +See also `erc-lurker-trim-nicks' and `erc-lurker-ignore-chars'. In order to limit memory consumption, this function also calls `erc-lurker-cleanup' once every `erc-lurker-cleanup-interval' updates of `erc-lurker-state'." - (when (and (boundp 'parsed) (erc-response-p parsed)) - (let* ((command (erc-response.command parsed)) + (when (and (boundp 'erc-message-parsed) + (erc-response-p erc-message-parsed)) + (let* ((command (erc-response.command erc-message-parsed)) (sender (erc-lurker-maybe-trim - (car (erc-parse-user (erc-response.sender parsed))))) + (car (erc-parse-user + (erc-response.sender erc-message-parsed))))) (server (erc-canonicalize-server-name erc-server-announced-name))) (when (equal command "PRIVMSG") @@ -2704,7 +2708,8 @@ erc-display-message See also `erc-format-message' and `erc-display-line'." (let ((string (if (symbolp msg) (apply #'erc-format-message msg args) - msg))) + msg)) + (erc-message-parsed parsed)) (setq string (cond ((null type) -- 2.23.0 --=-=-=--