From 4b17cc314771532fa1a6a617c3961f44bd2a5e7f Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Mon, 7 Aug 2023 03:35:56 -0700 Subject: [PATCH] Deprecate erc-button-nickname-callback-function * lisp/erc/erc-button.el (erc-button-nickname-callback-function): Deprecate this function-valued variable, first introduced in ERC 5.6 and Emacs 30, to dissuade consumers of the old `erc-button-alist' nickname interface from meddling with the on-click callback of buttonized nicks. If necessary, third parties can instead add their own propertizing logic in something like `erc-insert-modify-hook'. Also change default callback to a wrapper that discards all but the first arg. This effectively declares that `erc-data' values for nicknames may contain more than one element in the near future. (erc-button--perform-nick-popup): New default nick-button callback function wrapping `erc-nick-popup' in order to adapt it to the `erc-button-nickname-callback-function' interface. (Bug#60933) --- lisp/erc/erc-button.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el index 89a6cd131c0..bfaf4fa821a 100644 --- a/lisp/erc/erc-button.el +++ b/lisp/erc/erc-button.el @@ -279,8 +279,13 @@ themselves." " entries are deprecated. Either use a variable or a function" " that conditionally calls `erc-button-add-button'."))))) -(defvar erc-button-nickname-callback-function #'erc-nick-popup - "Escape hatch for those needing a different nickname callback.") +(defvar erc-button-nickname-callback-function #'erc-button--perform-nick-popup + "Escape hatch for users needing a non-standard nick-button callback. +Value should be a function accepting a NICK and any number of +trailing arguments that are as yet unspecified. Runs when +clicking \\`' or hitting \\`RET' atop a nickname button.") +(make-obsolete-variable 'erc-button-nickname-callback-function + "default provides essential functionality" "30.1") (defun erc-button-add-buttons () "Find external references in the current buffer and make buttons of them. @@ -745,6 +750,10 @@ In server buffers, also prompt for a channel." (funcall code nick) (eval code `((nick . ,nick))))))) +(defun erc-button--perform-nick-popup (nick &rest _) + "Call `erc-nick-popup' with NICK." + (erc-nick-popup nick)) + ;;; Callback functions (defun erc-button-describe-symbol (symbol-name) "Describe SYMBOL-NAME. -- 2.39.2