Define variable alias for erc-completion-mode

* lisp/erc/erc-pcomplete.el (erc-completion-mode): New alias for the
variable `erc-pcomplete-mode' to complement the function alias of the
corresponding minor-mode command.  Given that user code operating on the
value of `erc-modules' needs to detect whether members are active, it
only makes sense to address this specially.  Before this change,
applying `bound-and-true-p' to `erc-completion-mode' would always return
nil, even when the module was active.  For normal aliases, that's indeed
expected because `define-erc-module' doesn't automatically define a mode
variable for a non-nil ALIAS argument.  Although in the long term it
probably should, while also obsoleting the "new" alias simultaneously,
that would likely break some user code and doubtless complicate things
majorly for `pcomplete', the one in-tree outlier.  The latter module
would then require changing either its preferred name, the one
advertised by `erc-modules' in its Custom definition, to `pcomplete' or
its primary name to `completion'.  Both are quite churn-inducing.
This commit is contained in:
F. Jason Park 2026-04-19 18:28:02 -07:00
parent 40b6f0180b
commit c7bca9f340

View file

@ -61,6 +61,11 @@ add this string to nicks completed."
;;;###autoload(put 'completion 'erc--feature 'erc-pcomplete)
;;;###autoload(autoload 'erc-completion-mode "erc-pcomplete" nil t)
(put 'completion 'erc-group 'erc-pcomplete)
;; For historical reasons, (the downcased version of) this module's
;; alias is the canonical name used by `erc-modules'. But user code
;; still needs to detect whether the module is enabled based on that
;; name alone, hence this variable alias.
(defvaralias 'erc-completion-mode 'erc-pcomplete-mode)
(define-erc-module pcomplete Completion
"In ERC Completion mode, the TAB key does completion whenever possible."
((add-hook 'erc-mode-hook #'pcomplete-erc-setup)