From: F. Jason Park Date: Fri, 21 Apr 2023 14:30:18 +0000 (-0700) Subject: Actually define erc-default-server-functions X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=90a9c7b7b594dfcdc985541eb366e5684136c3ec;p=emacs.git Actually define erc-default-server-functions * lisp/erc/erc-backend.el: Remove top-level `add-hook' for `erc-default-server-functions'. * lisp/erc/erc.el (erc-default-server-hook, erc-default-server-functions): Officially deprecate the former and rename it to the latter. (erc-default-server-handler): Mark obsolete because its replacement took over years ago. (erc-debug-missing-hooks): Append instead of mutate. --- diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index d14640e798d..0c970a9d586 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -1459,8 +1459,6 @@ Finds hooks by looking in the `erc-server-responses' hash table." (erc-with-server-buffer (run-hook-with-args 'erc-timer-hook (erc-current-time))))) -(add-hook 'erc-default-server-functions #'erc-handle-unknown-server-response) - (defun erc-handle-unknown-server-response (proc parsed) "Display unknown server response's message." (let ((line (concat (erc-response.sender parsed) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index fec1e1a4eb9..05b6b5bfd21 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -4689,9 +4689,13 @@ This places `point' just after the prompt, or at the beginning of the line." ; Stolen from ZenIRC. I just wanna test this code, so here is ; experiment area. -(defcustom erc-default-server-hook '(erc-debug-missing-hooks - erc-default-server-handler) - "Default for server messages which aren't covered by `erc-server-hooks'." +;; This shouldn't be a user option but remains so for compatibility. +(define-obsolete-variable-alias + 'erc-default-server-hook 'erc-default-server-functions "30.1") +(defcustom erc-default-server-functions '(erc-handle-unknown-server-response) + "Abnormal hook for incoming messages without their own handlers. +See `define-erc-response-handler' for more." + :package-version '(ERC . "5.6") :group 'erc-server-hooks :type 'hook) @@ -4699,6 +4703,7 @@ This places `point' just after the prompt, or at the beginning of the line." "Default server handler. Displays PROC and PARSED appropriately using `erc-display-message'." + (declare (obsolete erc-handle-unknown-server-response "29.1")) (erc-display-message parsed 'notice proc (mapconcat @@ -4721,7 +4726,7 @@ See `erc-debug-missing-hooks'.") "Add PARSED server message ERC does not yet handle to `erc-server-vectors'. These vectors can be helpful when adding new server message handlers to ERC. See `erc-default-server-hook'." - (nconc erc-server-vectors (list parsed)) + (setq erc-server-vectors `(,@erc-server-vectors ,parsed)) nil) (defun erc--open-target (target) @@ -4915,6 +4920,9 @@ See also `erc-display-error-notice'." ;;; Server messages +;; FIXME remove on next major version release. This group is all but +;; unused because most `erc-server-FOO-functions' are plain variables +;; and not user options as implied by this doc string. (defgroup erc-server-hooks nil "Server event callbacks. Every server event - like numeric replies - has its own hook.