unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Shynur Xie <one.last.kiss@outlook.com>, 64351@debbugs.gnu.org
Subject: bug#64351: probabe bug associated with “completion-regexp-list”
Date: Fri, 30 Jun 2023 14:33:49 -0400	[thread overview]
Message-ID: <jwvttuodcpb.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83v8f5sc6p.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 30 Jun 2023 09:21:02 +0300")

>> 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






  parent reply	other threads:[~2023-06-30 18:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-29 18:53 bug#64351: probabe bug associated with “completion-regexp-list” Shynur Xie
2023-06-30  6:21 ` Eli Zaretskii
2023-06-30 12:51   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-30 13:15     ` Eli Zaretskii
2023-06-30 14:17       ` Shynur Xie
2023-06-30 14:27         ` Andreas Schwab
2023-06-30 15:23           ` Shynur Xie
2023-06-30 18:33   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-06-30 18:45     ` Shynur Xie
2023-06-30 19:02       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-30 19:36         ` Shynur Xie
2023-06-30 23:24           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-30 19:52         ` Shynur Xie
2023-06-30 19:08     ` Eli Zaretskii
2023-07-01 14:19       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-02  6:18         ` Eli Zaretskii
2023-07-01  8:21     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvttuodcpb.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=64351@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=one.last.kiss@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).