GNU bug report logs -
#36843
26.2; ERC lurker feature broken
Previous Next
Reported by: Thibault Polge <thibault <at> thb.lt>
Date: Mon, 29 Jul 2019 22:06:02 UTC
Severity: normal
Tags: fixed, patch
Found in versions 24.4, 26.2
Fixed in version 27.1
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #10 received at 36843 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Below is a patch that seems to fix this. I haven’t tested the actual
patch but I’ve added its changed to my init file (adding the new defvar,
and redefining erc-display-message and erc-lurker-update-status) for the
last couple of days, and it seems to work as intended.
Thanks to Noam for helping me with this over on #emacs.
[0001-Fix-erc-lurker-update-status.patch (text/x-diff, inline)]
From 389654f5c7a9ad0975bff84a163ed6234cdb3cb8 Mon Sep 17 00:00:00 2001
From: Amin Bandali <bandali <at> gnu.org>
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
`erc-display-message', and change `erc-lurker-update-status' to use
that 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.22.0
This bug report was last modified 5 years and 264 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.