Skip to content

Commit e2cc16f

Browse files
committed
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.
1 parent 8af96d8 commit e2cc16f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lisp/erc/erc-nicks.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,12 @@ Abandon search after examining LIMIT faces."
480480
"Uniquely colorize nicknames in target buffers."
481481
((if erc--target
482482
(progn
483+
(erc-with-server-buffer
484+
(unless erc-nicks-mode
485+
(erc--warn-once-before-connect 'erc-nicks-mode
486+
"Module `nicks' must be enabled or disabled session-wide."
487+
" Toggling it in individual target buffers is unsupported.")
488+
(erc-nicks-mode +1))) ; but do it anyway
483489
(setq erc-nicks--downcased-skip-nicks
484490
(mapcar #'erc-downcase erc-nicks-skip-nicks))
485491
(add-function :filter-return (local 'erc-button--modify-nick-function)

0 commit comments

Comments
 (0)