aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmin Bandali2019-08-17 14:09:11 -0400
committerNoam Postavsky2019-09-05 19:56:14 -0400
commitff0f4c731231b03d73cc35de9e042d1fc1b75f4e (patch)
tree76f2e82e4e93cb5249afd12852203fae82827772
parent16ab25f136c4eef27743dfa50953692d115f162c (diff)
downloademacs-ff0f4c731231b03d73cc35de9e042d1fc1b75f4e.tar.gz
emacs-ff0f4c731231b03d73cc35de9e042d1fc1b75f4e.zip
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.
-rw-r--r--lisp/erc/erc.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index f5c9decc3a2..fd1bd5545da 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -2594,6 +2594,8 @@ every `erc-lurker-cleanup-interval' updates to
2594consumption of lurker state during long Emacs sessions and/or ERC 2594consumption of lurker state during long Emacs sessions and/or ERC
2595sessions with large numbers of incoming PRIVMSGs.") 2595sessions with large numbers of incoming PRIVMSGs.")
2596 2596
2597(defvar erc-message-parsed)
2598
2597(defun erc-lurker-update-status (_message) 2599(defun erc-lurker-update-status (_message)
2598 "Update `erc-lurker-state' if necessary. 2600 "Update `erc-lurker-state' if necessary.
2599 2601
@@ -2603,18 +2605,20 @@ reflect the fact that its sender has issued a PRIVMSG at the
2603current time. Otherwise, take no action. 2605current time. Otherwise, take no action.
2604 2606
2605This function depends on the fact that `erc-display-message' 2607This function depends on the fact that `erc-display-message'
2606dynamically binds `parsed', which is used to check if the current 2608dynamically binds `erc-message-parsed', which is used to check if
2607message is a PRIVMSG and to determine its sender. See also 2609the current message is a PRIVMSG and to determine its sender.
2608`erc-lurker-trim-nicks' and `erc-lurker-ignore-chars'. 2610See also `erc-lurker-trim-nicks' and `erc-lurker-ignore-chars'.
2609 2611
2610In order to limit memory consumption, this function also calls 2612In order to limit memory consumption, this function also calls
2611`erc-lurker-cleanup' once every `erc-lurker-cleanup-interval' 2613`erc-lurker-cleanup' once every `erc-lurker-cleanup-interval'
2612updates of `erc-lurker-state'." 2614updates of `erc-lurker-state'."
2613 (when (and (boundp 'parsed) (erc-response-p parsed)) 2615 (when (and (boundp 'erc-message-parsed)
2614 (let* ((command (erc-response.command parsed)) 2616 (erc-response-p erc-message-parsed))
2617 (let* ((command (erc-response.command erc-message-parsed))
2615 (sender 2618 (sender
2616 (erc-lurker-maybe-trim 2619 (erc-lurker-maybe-trim
2617 (car (erc-parse-user (erc-response.sender parsed))))) 2620 (car (erc-parse-user
2621 (erc-response.sender erc-message-parsed)))))
2618 (server 2622 (server
2619 (erc-canonicalize-server-name erc-server-announced-name))) 2623 (erc-canonicalize-server-name erc-server-announced-name)))
2620 (when (equal command "PRIVMSG") 2624 (when (equal command "PRIVMSG")
@@ -2704,7 +2708,8 @@ ARGS, PARSED, and TYPE are used to format MSG sensibly.
2704See also `erc-format-message' and `erc-display-line'." 2708See also `erc-format-message' and `erc-display-line'."
2705 (let ((string (if (symbolp msg) 2709 (let ((string (if (symbolp msg)
2706 (apply #'erc-format-message msg args) 2710 (apply #'erc-format-message msg args)
2707 msg))) 2711 msg))
2712 (erc-message-parsed parsed))
2708 (setq string 2713 (setq string
2709 (cond 2714 (cond
2710 ((null type) 2715 ((null type)