bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#64351: probabe bug associated with “completion-regexp-list”


From: Stefan Monnier
Subject: bug#64351: probabe bug associated with “completion-regexp-list”
Date: Fri, 30 Jun 2023 14:33:49 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

>> Evaluate this:
>>     (setq completion-regexp-list '("^[^-]"))

Bad idea.
Admittedly, `completion-regexp-list` is documented poorly enough that
it's not clear what usage is valid and what isn't, but a lot of
completion code will be broken if you set it globally to anything else
than nil.

>> Then type “C-h v -l TAB”, an error will be thrown.
> Stefan, is the below the right fix?  If it is, do you think it is safe
> enough for the release branch?
>
> diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
> index 4aa1ab3..3e30b68 100644
> --- a/lisp/minibuffer.el
> +++ b/lisp/minibuffer.el
> @@ -4027,7 +4027,8 @@ completion-pcm--merge-completions
>                (setq ccs (nreverse ccs))
>                (let* ((prefix (try-completion fixed comps))
>                       (unique (or (and (eq prefix t) (setq prefix fixed))
> -                                 (eq t (try-completion prefix comps)))))
> +                                 (and (stringp prefix)
> +                                      (eq t (try-completion prefix 
> comps))))))
>                  (unless (or (eq elem 'prefix)
>                              (equal prefix ""))
>                    (push prefix res))

I'd argue that the better fix is to let-bind `completion-regexp-list` to
nil around the `minibuffer.el` code which uses
`try/all/test-completion` to protect against those kinds of misuses.
Or alternatively to say "if it hurts, don't do that".


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]