aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/erc
diff options
context:
space:
mode:
authorF. Jason Park2024-08-18 23:50:58 -0700
committerF. Jason Park2024-09-29 16:13:01 -0700
commit15545e15a343cc45561a3ff6b8ea930835b7ff08 (patch)
treeed986d1a18c0c28e23e499d8378e28f3d07f4327 /lisp/erc
parentb0ebb82076315f8e50159aff6caded4c5ee4438c (diff)
downloademacs-15545e15a343cc45561a3ff6b8ea930835b7ff08.tar.gz
emacs-15545e15a343cc45561a3ff6b8ea930835b7ff08.zip
Bind current erc-response around all handlers
* lisp/erc/erc-backend.el (erc--parsed-response): New variable to be the internal version of the ancient `erc-message-parsed', which is only available during `erc-display-message', and therefore of somewhat limited utility. (erc-call-hooks): Bind `erc--parsed-response' to the parsed `erc-response' object for the duration of its handling. Bind `erc--msg-prop-overrides' around all hooks to allow response handlers to influence inserted msg props for any `erc-display-message' calls. (Bug#72736)
Diffstat (limited to 'lisp/erc')
-rw-r--r--lisp/erc/erc-backend.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 9aedc110067..d999cf57db8 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -1534,11 +1534,15 @@ See also `erc-server-responses'."
1534 (gethash (format (if (numberp command) "%03i" "%s") command) 1534 (gethash (format (if (numberp command) "%03i" "%s") command)
1535 erc-server-responses)) 1535 erc-server-responses))
1536 1536
1537(defvar erc--parsed-response nil)
1538
1537(defun erc-call-hooks (process message) 1539(defun erc-call-hooks (process message)
1538 "Call hooks associated with MESSAGE in PROCESS. 1540 "Call hooks associated with MESSAGE in PROCESS.
1539 1541
1540Finds hooks by looking in the `erc-server-responses' hash table." 1542Finds hooks by looking in the `erc-server-responses' hash table."
1541 (let ((hook (or (erc-get-hook (erc-response.command message)) 1543 (let ((erc--parsed-response message)
1544 (erc--msg-prop-overrides erc--msg-prop-overrides)
1545 (hook (or (erc-get-hook (erc-response.command message))
1542 'erc-default-server-functions))) 1546 'erc-default-server-functions)))
1543 (run-hook-with-args-until-success hook process message) 1547 (run-hook-with-args-until-success hook process message)
1544 ;; Some handlers, like `erc-cmd-JOIN', open new targets without 1548 ;; Some handlers, like `erc-cmd-JOIN', open new targets without