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:17:19 -0400

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

* lisp/minibuffer.el (completion-pcm--pattern->regex): Fix
regex. (bug#72425)
---
 lisp/minibuffer.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 5860c4238c2..cefd4247370 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3896,7 +3896,7 @@ completion-pcm--pattern->regex
                      (t
                       (let ((re (if (eq x 'any-delim)
                                     (concat completion-pcm--delim-wild-regex "*?")
-                                  ".*?")))
+                                  "[^z-a]*?")))
                         (if (if (consp group) (memq x group) group)
                             (concat "\\(" re "\\)")
                           re)))))
-- 
2.39.3