[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master ff0f4c7: Fix erc-lurker-update-status (bug#36843)
From: |
Noam Postavsky |
Subject: |
[Emacs-diffs] master ff0f4c7: Fix erc-lurker-update-status (bug#36843) |
Date: |
Thu, 5 Sep 2019 19:56:52 -0400 (EDT) |
branch: master
commit ff0f4c731231b03d73cc35de9e042d1fc1b75f4e
Author: Amin Bandali <address@hidden>
Commit: Noam Postavsky <address@hidden>
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 f5c9dec..fd1bd55 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -2594,6 +2594,8 @@ every `erc-lurker-cleanup-interval' updates to
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 @@ reflect the fact that its sender has issued a PRIVMSG
at the
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 @@ ARGS, PARSED, and TYPE are used to format MSG sensibly.
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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master ff0f4c7: Fix erc-lurker-update-status (bug#36843),
Noam Postavsky <=