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

From: Spencer Baugh <[email-masked]>
Date: Fri, 02 Aug 2024 12:14:56 -0400

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