From b1007516cdf7a21b44340838d9d9509a81577436 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Sat, 25 Mar 2023 09:13:40 -0700 Subject: [PATCH] Add subcommand dispatch facility to erc-cmd-HELP * lisp/erc/erc.el (erc-cmd-HELP): Change signature by adding &rest parameter. Look for symbol property `erc--cmd-help' and, if found, assume it's a function and call it with &rest args after attempting to autoload the primary command symbol. (Bug#62444.) --- lisp/erc/erc.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index f0ea7510c65..f76c770f585 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -3204,7 +3204,7 @@ VERSION and so on. It is called with ARGS." (erc-send-ctcp-message nick str) t)) -(defun erc-cmd-HELP (&optional func) +(defun erc-cmd-HELP (&optional func &rest rest) "Popup help information. If FUNC contains a valid function or variable, help about that @@ -3237,6 +3237,10 @@ For a list of user commands (/join /part, ...): nil))))) (if sym (cond + ((get sym 'erc--cmd-help) + (when (autoloadp (symbol-function sym)) + (autoload-do-load (symbol-function sym))) + (apply (get sym 'erc--cmd-help) rest)) ((boundp sym) (describe-variable sym)) ((fboundp sym) (describe-function sym)) (t nil)) -- 2.39.2