Warn when toggling erc-nicks-mode in target buffers

* lisp/erc/erc-nicks.el (erc-nicks-mode, erc-nicks-enable): This local
module isn't autoloaded like most global modules, in part to dissuade
users from attempting to enable it by running M-x erc-nicks-mode RET.
However, rather than signal an error upon detecting such an attempt,
ERC should explain that the only supported means of activation is via
`erc-modules'.  This change does that and then enables it anyway,
despite the degraded experience.
This commit is contained in:
F. Jason Park 2023-07-18 22:18:00 -07:00
parent 8af96d831f
commit e2cc16fbd0

View file

@ -480,6 +480,12 @@ Abandon search after examining LIMIT faces."
"Uniquely colorize nicknames in target buffers."
((if erc--target
(progn
(erc-with-server-buffer
(unless erc-nicks-mode
(erc--warn-once-before-connect 'erc-nicks-mode
"Module `nicks' must be enabled or disabled session-wide."
" Toggling it in individual target buffers is unsupported.")
(erc-nicks-mode +1))) ; but do it anyway
(setq erc-nicks--downcased-skip-nicks
(mapcar #'erc-downcase erc-nicks-skip-nicks))
(add-function :filter-return (local 'erc-button--modify-nick-function)