From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alex Branham Newsgroups: gmane.emacs.bugs Subject: bug#36843: 26.2; ERC lurker feature broken Date: Wed, 04 Sep 2019 09:05:12 -0500 Message-ID: <87ef0wdunb.fsf@gmail.com> References: <877e80o5tb.fsf@thb.lt> <87v9uvmyib.fsf@gnu.org> <871rxao6lc.fsf@gmail.com> <877e6y7k9n.fsf@fencepost.gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="176279"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Thibault Polge , Noam Postavsky , 36843@debbugs.gnu.org To: Amin Bandali Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 04 16:06:12 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 1i5VvI-000jjL-CH for geb-bug-gnu-emacs@m.gmane.org; Wed, 04 Sep 2019 16:06:12 +0200 Original-Received: from localhost ([::1]:60680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5VvG-0000Na-Vy for geb-bug-gnu-emacs@m.gmane.org; Wed, 04 Sep 2019 10:06:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43599) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Vv9-0000NT-EJ for bug-gnu-emacs@gnu.org; Wed, 04 Sep 2019 10:06:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5Vv8-0006Yo-3I for bug-gnu-emacs@gnu.org; Wed, 04 Sep 2019 10:06:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53465) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5Vv7-0006Yc-VS for bug-gnu-emacs@gnu.org; Wed, 04 Sep 2019 10:06:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i5Vv7-00013h-P9 for bug-gnu-emacs@gnu.org; Wed, 04 Sep 2019 10:06:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Branham Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 Sep 2019 14:06:01 +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.15676059224013 (code B ref 36843); Wed, 04 Sep 2019 14:06:01 +0000 Original-Received: (at 36843) by debbugs.gnu.org; 4 Sep 2019 14:05:22 +0000 Original-Received: from localhost ([127.0.0.1]:34053 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i5VuU-00012e-74 for submit@debbugs.gnu.org; Wed, 04 Sep 2019 10:05:22 -0400 Original-Received: from mail-oi1-f172.google.com ([209.85.167.172]:36731) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i5VuS-00012R-4M for 36843@debbugs.gnu.org; Wed, 04 Sep 2019 10:05:20 -0400 Original-Received: by mail-oi1-f172.google.com with SMTP id k20so9482357oih.3 for <36843@debbugs.gnu.org>; Wed, 04 Sep 2019 07:05:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=v5c8T93UttRd1+PoWvQdATioMOLnhFm/VQ+gDENH58g=; b=QpxiyrGp1vadtzAtOZfAp3j+46MdJ3DaUnwkywDmntRhogd9+qXi+soWSr3iNrFpWO BxCGSYiV6FmS74BgjRQjkBXYZzfH3wTHc35HaNNFdWSRySxfnMQga82VQV0qXdyhDmHE B6c0GeCwtGCNtiwnwqc7K5Kokpn8Ao3MdQRqCjEwc7nUnXCC+FLvCGUaEjljLcKb9w6W ZJK0bKnBgOoy4pFPU2sZ3Y8t0EWqhZLvuTSuWbG/qFqFjC4mIwWQGLuQXIQtUyWd+TUo YwxOf3Ahu4K51LifY1l71dPoZYrTvIls3culjSnRxkGMO7IltF0fySmd3rjzUUpcF9A9 9J9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=v5c8T93UttRd1+PoWvQdATioMOLnhFm/VQ+gDENH58g=; b=el6iWTC4cz/r/ewz+NPx7DfM/WhBr2UGBanbFDlKCtf5cfqvlOUs/4HIStNCvvuHm9 6M5D/r3w+tvcUUvEu1ETG795dfLheDt+D+giyNAIX5M0mx98C/c2u6ni72gBeEs3XyJm nEytqkFryvCcCKGpUSg+MNNhgw7qovAh6Tg9+QQrhv4zDjlWl6pgIAFxyEgEok6aV0lY /807fEJEsPfcEe+UsS88DBVaf0nc+yw6O5oJhxUiaa464G0Pj6EGIHRXtSb0vmAruFjV Phyi4lk/vPkNkWxM7KFEbuM0PkwE4GU8TQ/dmaLOOnO2R5MEAjtDc/7gGnleu+PrvhY3 qfrA== X-Gm-Message-State: APjAAAUqEEHbj1ntLlx2C+scJR2EFI/0uIU0THw1FvhXlakAi0r7TuQ/ wkWZ2qmBKp2gmsf/3xFvUnOYl6sb X-Google-Smtp-Source: APXvYqybafEplhGErniWlAcmc0m7hpFd1i3HEkb9dJ0WrzsPj7A/kTt4ZfNcVvDIG1cDACYAMBE7dQ== X-Received: by 2002:aca:911:: with SMTP id 17mr3164836oij.149.1567605914177; Wed, 04 Sep 2019 07:05:14 -0700 (PDT) Original-Received: from mars (cpe-70-114-192-208.austin.res.rr.com. [70.114.192.208]) by smtp.gmail.com with ESMTPSA id f84sm5955515oig.43.2019.09.04.07.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 07:05:13 -0700 (PDT) In-Reply-To: <877e6y7k9n.fsf@fencepost.gnu.org> (Amin Bandali's message of "Tue, 27 Aug 2019 10:31:00 -0400") 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:166194 Archived-At: On Tue 27 Aug 2019 at 10:31, Amin Bandali wrote: Is this OK to apply to master? I've been using it locally and seems to work well. >>> 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. > >>>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.") >=20=20 > +(defvar erc-message-parsed) > + > (defun erc-lurker-update-status (_message) > "Update `erc-lurker-state' if necessary. >=20=20 > @@ -2603,18 +2605,20 @@ erc-lurker-update-status > current time. Otherwise, take no action. >=20=20 > 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'. >=20=20 > 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)