all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Amin Bandali <bandali@gnu.org>
To: Noam Postavsky <npostavs@gmail.com>
Cc: Thibault Polge <thibault@thb.lt>, 36843@debbugs.gnu.org
Subject: bug#36843: 26.2; ERC lurker feature broken
Date: Tue, 27 Aug 2019 10:31:00 -0400	[thread overview]
Message-ID: <877e6y7k9n.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <871rxao6lc.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1186 bytes --]

Noam Postavsky <npostavs@gmail.com> writes:

> Amin Bandali <bandali@gnu.org> writes:
>
>> From: Amin Bandali <bandali@gnu.org>
>
> 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’d changed my email back in
December 2018 and had notified the copyright clerk about it, but it
seems that their change hadn’t properly propagated to copyright.list.
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’ve attached an updated patch below.

Thanks for your feedback.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-erc-lurker-update-status-bug-36843.patch --]
[-- Type: text/x-diff, Size: 2777 bytes --]

From 2bc8f35e4a0f76e7b59950738fbfdc3c3e48263c Mon Sep 17 00:00:00 2001
From: Amin Bandali <bandali@gnu.org>
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


  reply	other threads:[~2019-08-27 14:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-29 22:05 bug#36843: 26.2; ERC lurker feature broken Thibault Polge
2019-08-17 18:34 ` Amin Bandali
2019-08-18 19:23   ` Alex Branham
2019-08-22 16:54     ` Thibault Polge
2019-08-24 16:45   ` Noam Postavsky
2019-08-27 14:31     ` Amin Bandali [this message]
2019-09-04 14:05       ` Alex Branham
2019-09-05 23:57       ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877e6y7k9n.fsf@fencepost.gnu.org \
    --to=bandali@gnu.org \
    --cc=36843@debbugs.gnu.org \
    --cc=npostavs@gmail.com \
    --cc=thibault@thb.lt \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.