1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

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)
This commit is contained in:
F. Jason Park 2023-08-07 03:35:56 -07:00
parent 35a670a2f6
commit 4b17cc3147

View file

@ -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 \\`<mouse-1>' 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.