[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#69501: 30.0.50; customize-mode error with substring completion style
From: |
Stefan Monnier |
Subject: |
bug#69501: 30.0.50; customize-mode error with substring completion style |
Date: |
Thu, 14 Mar 2024 14:11:20 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> In general, let-binding completion-regexp-list around completing-read is
> not a great idea IMO
Definitely: `completion-regexp-list` should be let-bound only right
around calls to `try/all-completions`.
> because it affects recursive minibuffers as well.
> So perhaps the best solution is to avoid doing that in customize-mode,
> and to rely only on the predicate argument of completing-read instead?
Indeed (see patch below).
We should probably also change the completion code so it defends against
such let-bindings of `completion-regexp-list`.
Stefan
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 8fad51dc116..f004002333b 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -1159,14 +1159,15 @@ customize-mode
for the MODE to customize."
(interactive
(list
- (let ((completion-regexp-list '("-mode\\'"))
- (group (custom-group-of-mode major-mode)))
+ (let ((group (custom-group-of-mode major-mode)))
(if (and group (not current-prefix-arg))
major-mode
(intern
(completing-read (format-prompt "Mode" (and group major-mode))
obarray
- 'custom-group-of-mode
+ (lambda (s)
+ (and (string-match "-mode\\'" (symbol-name s))
+ (custom-group-of-mode s)))
t nil nil (if group (symbol-name major-mode))))))))
(customize-group (custom-group-of-mode mode)))