From e2cc16fbd0d16e6c0ff59221af49e3d4113500cd Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Tue, 18 Jul 2023 22:18:00 -0700 Subject: [PATCH] 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. --- lisp/erc/erc-nicks.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lisp/erc/erc-nicks.el b/lisp/erc/erc-nicks.el index 3f753adc625..67f513f8d3e 100644 --- a/lisp/erc/erc-nicks.el +++ b/lisp/erc/erc-nicks.el @@ -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) -- 2.39.5