diff options
| author | Amin Bandali | 2019-08-17 14:09:11 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2019-09-05 19:56:14 -0400 |
| commit | ff0f4c731231b03d73cc35de9e042d1fc1b75f4e (patch) | |
| tree | 76f2e82e4e93cb5249afd12852203fae82827772 | |
| parent | 16ab25f136c4eef27743dfa50953692d115f162c (diff) | |
| download | emacs-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.el | 19 |
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 | |||
| 2594 | consumption of lurker state during long Emacs sessions and/or ERC | 2594 | consumption of lurker state during long Emacs sessions and/or ERC |
| 2595 | sessions with large numbers of incoming PRIVMSGs.") | 2595 | sessions 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 | |||
| 2603 | current time. Otherwise, take no action. | 2605 | current time. Otherwise, take no action. |
| 2604 | 2606 | ||
| 2605 | This function depends on the fact that `erc-display-message' | 2607 | This function depends on the fact that `erc-display-message' |
| 2606 | dynamically binds `parsed', which is used to check if the current | 2608 | dynamically binds `erc-message-parsed', which is used to check if |
| 2607 | message is a PRIVMSG and to determine its sender. See also | 2609 | the current message is a PRIVMSG and to determine its sender. |
| 2608 | `erc-lurker-trim-nicks' and `erc-lurker-ignore-chars'. | 2610 | See also `erc-lurker-trim-nicks' and `erc-lurker-ignore-chars'. |
| 2609 | 2611 | ||
| 2610 | In order to limit memory consumption, this function also calls | 2612 | In 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' |
| 2612 | updates of `erc-lurker-state'." | 2614 | updates 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. | |||
| 2704 | See also `erc-format-message' and `erc-display-line'." | 2708 | See 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) |