GNU bug report logs - #64351
probabe bug associated with “completion-regexp-list”

Previous Next

Package: emacs;

Reported by: Shynur Xie <one.last.kiss <at> outlook.com>

Date: Thu, 29 Jun 2023 18:59:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Shynur Xie <one.last.kiss <at> outlook.com>, 64351 <at> debbugs.gnu.org
Subject: bug#64351: probabe bug associated with “completion-regexp-list”
Date: Fri, 30 Jun 2023 14:33:49 -0400
>> 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





This bug report was last modified 2 years and 19 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.