* bug#69501: 30.0.50; customize-mode error with substring completion style
@ 2024-03-02 8:59 Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-04 13:16 ` Eli Zaretskii
2024-03-14 18:11 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 2 replies; 6+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-02 8:59 UTC (permalink / raw)
To: 69501
Hi,
With both Emacs 29.2 and with the current master:
1. emacs -Q
2. (setq completion-styles '(substring))
3. C-u M-x customize-mode TAB
4. "Assertion failed: (stringp suffix)"
I not sure exactly why this error occurs, but IIUC it has to do with the
fact that customize-mode let-binds completion-regexp-list. I suspect
that the substring completion style doesn't handle that correctly.
In general, let-binding completion-regexp-list around completing-read is
not a great idea IMO 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?
Best,
Eshel
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#69501: 30.0.50; customize-mode error with substring completion style
2024-03-02 8:59 bug#69501: 30.0.50; customize-mode error with substring completion style Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-04 13:16 ` Eli Zaretskii
2024-03-05 12:36 ` Mauro Aranda
2024-03-14 18:11 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2024-03-04 13:16 UTC (permalink / raw)
To: Eshel Yaron, Stefan Monnier, Mauro Aranda; +Cc: 69501
> Date: Sat, 02 Mar 2024 09:59:48 +0100
> From: Eshel Yaron via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
> With both Emacs 29.2 and with the current master:
>
> 1. emacs -Q
> 2. (setq completion-styles '(substring))
> 3. C-u M-x customize-mode TAB
> 4. "Assertion failed: (stringp suffix)"
>
> I not sure exactly why this error occurs, but IIUC it has to do with the
> fact that customize-mode let-binds completion-regexp-list. I suspect
> that the substring completion style doesn't handle that correctly.
>
> In general, let-binding completion-regexp-list around completing-read is
> not a great idea IMO 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?
Stefan and Mauro, any suggestions?
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#69501: 30.0.50; customize-mode error with substring completion style
2024-03-04 13:16 ` Eli Zaretskii
@ 2024-03-05 12:36 ` Mauro Aranda
2024-03-14 8:26 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: Mauro Aranda @ 2024-03-05 12:36 UTC (permalink / raw)
To: Eli Zaretskii, Eshel Yaron, Stefan Monnier; +Cc: 69501
On 4/3/24 10:16, Eli Zaretskii wrote:
>> Date: Sat, 02 Mar 2024 09:59:48 +0100
>> From: Eshel Yaron via "Bug reports for GNU Emacs,
>> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>
>> With both Emacs 29.2 and with the current master:
>>
>> 1. emacs -Q
>> 2. (setq completion-styles '(substring))
>> 3. C-u M-x customize-mode TAB
>> 4. "Assertion failed: (stringp suffix)"
>>
>> I not sure exactly why this error occurs, but IIUC it has to do with the
>> fact that customize-mode let-binds completion-regexp-list. I suspect
>> that the substring completion style doesn't handle that correctly.
>>
>> In general, let-binding completion-regexp-list around completing-read is
>> not a great idea IMO 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?
>
> Stefan and Mauro, any suggestions?
I took a quick look, but I don't know how "relying on the predicate
argument of completing-read" looks in practice. It seems I have
forgotten how to use the completion functions (if I ever knew how to use
them at all). Hopefully Stefan will be of more help.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#69501: 30.0.50; customize-mode error with substring completion style
2024-03-05 12:36 ` Mauro Aranda
@ 2024-03-14 8:26 ` Eli Zaretskii
0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2024-03-14 8:26 UTC (permalink / raw)
To: monnier, Mauro Aranda; +Cc: 69501, me
> Date: Tue, 5 Mar 2024 09:36:01 -0300
> Cc: 69501@debbugs.gnu.org
> From: Mauro Aranda <maurooaranda@gmail.com>
>
> On 4/3/24 10:16, Eli Zaretskii wrote:
> >> Date: Sat, 02 Mar 2024 09:59:48 +0100
> >> From: Eshel Yaron via "Bug reports for GNU Emacs,
> >> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> >>
> >> With both Emacs 29.2 and with the current master:
> >>
> >> 1. emacs -Q
> >> 2. (setq completion-styles '(substring))
> >> 3. C-u M-x customize-mode TAB
> >> 4. "Assertion failed: (stringp suffix)"
> >>
> >> I not sure exactly why this error occurs, but IIUC it has to do with the
> >> fact that customize-mode let-binds completion-regexp-list. I suspect
> >> that the substring completion style doesn't handle that correctly.
> >>
> >> In general, let-binding completion-regexp-list around completing-read is
> >> not a great idea IMO 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?
> >
> > Stefan and Mauro, any suggestions?
>
> I took a quick look, but I don't know how "relying on the predicate
> argument of completing-read" looks in practice. It seems I have
> forgotten how to use the completion functions (if I ever knew how to use
> them at all). Hopefully Stefan will be of more help.
Stefan?
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#69501: 30.0.50; customize-mode error with substring completion style
2024-03-02 8:59 bug#69501: 30.0.50; customize-mode error with substring completion style Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-04 13:16 ` Eli Zaretskii
@ 2024-03-14 18:11 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-15 2:00 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-14 18:11 UTC (permalink / raw)
To: Eshel Yaron; +Cc: 69501
> 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)))
^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#69501: 30.0.50; customize-mode error with substring completion style
2024-03-14 18:11 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-15 2:00 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-15 2:00 UTC (permalink / raw)
To: Eshel Yaron; +Cc: 69501
> Indeed (see patch below).
Pushed to `master`.
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-15 2:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-02 8:59 bug#69501: 30.0.50; customize-mode error with substring completion style Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-04 13:16 ` Eli Zaretskii
2024-03-05 12:36 ` Mauro Aranda
2024-03-14 8:26 ` Eli Zaretskii
2024-03-14 18:11 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-15 2:00 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.