From f8982577fb61863d47497e86686ca20a932b71da Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Mon, 7 Aug 2023 03:35:56 -0700 Subject: [PATCH 2/3] [5.6] 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, to dissuade consumers of the old `erc-button-alist' nickname interface from meddling with the on-click callback of buttonized nicks. They should 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 may contain more than one element in the near future. (erc-button--perform-nick-popup): New default nick-button callback function that calls `erc-nick-popup' with the first argument and ignores the rest. (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 @@ erc-button-setup " 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 @@ erc-nick-popup (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.41.0