Subject: bug#72425: closed (Re: bug#72425: 29.2.50; substring (and other PCM styles) fails with candidates containing newlines)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 15 Aug 2024 07:45:02 +0000

Your bug report

#72425: 29.2.50; substring (and other PCM styles) fails with candidates containing newlines

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
72425: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=72425
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#72425: 29.2.50; substring (and other PCM styles) fails with candidates containing newlines
From: Eli Zaretskii <[email-masked]>
To: Stefan Monnier <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked]
Date: Thu, 15 Aug 2024 10:43:25 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> Cc: [email-masked], Dmitry Gutov <[email-masked]>
> Date: Tue, 13 Aug 2024 20:51:28 -0400
> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> > Patch to fix:
> >
> > From dfac112fa23d503b671fa5f9901411a4556bf054 Mon Sep 17 00:00:00 2001
> > From: Spencer Baugh <[email-masked]>
> > Date: Fri, 2 Aug 2024 12:15:58 -0400
> > Subject: [PATCH] Fix partial-completion for completion candidates containing
> >  newlines
> >
> > partial-completion tries to match a pattern containing wildcards (such
> > as `any' or `prefix') against completion candidates.  Wildcards are
> > supposed to match any sequence of characters, but
> > completion-pcm--pattern->regex transformed the wildcards into ".*",
> > which won't match sequences containing newlines.  Fix this to properly
> > match anything by using "[^z-a]*" instead.  (That's (rx (* anything)))
> 
> Looks fine to me.  I find [^z-a] a bit too magical, so maybe an `rx`
> pattern would be more clear.

Thanks, installed on master, and closing the bug.

> My guess is that completion of thingies with newlines is probably going
> to bump into other problems.  🙂

Exciting new bugs!

Subject: 29.2.50; substring (and other PCM styles) fails with candidates containing newlines
From: Spencer Baugh <[email-masked]>
To: [email-masked]
Cc: Dmitry Gutov <[email-masked]>, Stefan Monnier <[email-masked]>
Date: Fri, 02 Aug 2024 12:14:56 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

1. emacs -Q
2. (let ((completion-styles '(substring)))
     (completing-read ":" '("foo1bar" "foo2bar") nil nil "bar"))
3. Press TAB
4. foo1bar and foo2bar are suggested as completion candidates, because
   they contain "bar" as a substring.
5. (let ((completion-styles '(substring)))
     (completing-read ":" '("foo1\nbar" "foo2\nbar") nil nil "bar"))
6. Press TAB
7. Observe "[No match]" is printed.

This is due to a regex using "." when it should use a pattern which
actually matches anything, such as "[^z-a]".  A patch to fix will
follow.

In GNU Emacs 29.2.50 (build 9, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw scroll bars) of 2024-07-30 built on
 igm-qws-u22796a
Repository revision: cd9604db959c439c5695cf79f6533b5cbd340851
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Rocky Linux 8.10 (Green Obsidian)

Configured using:
 'configure --with-x-toolkit=lucid --without-gpm --without-gconf
 --without-selinux --without-imagemagick --with-modules --with-gif=no
 --with-cairo --with-rsvg --without-compress-install
 --with-native-compilation=aot --with-tree-sitter
 PKG_CONFIG_PATH=/usr/local/home/garnish/libtree-sitter/0.22.6-1/lib/pkgconfig/'

Configured features:
CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11
XDBE XIM XINPUT2 XPM LUCID ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l