From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function Date: Sun, 12 Nov 2023 13:26:10 -0800 Message-ID: <878r72odzs.fsf@breatheoutbreathe.in> References: <87r0mni6m1.fsf@breatheoutbreathe.in> <87bkdq3nw6.fsf@web.de> <875y3yx221.fsf@breatheoutbreathe.in> <87pm260wh9.fsf@web.de> <87v8bx48ww.fsf@breatheoutbreathe.in> <87msx8sbpv.fsf@web.de> <87bkdoh1gy.fsf@breatheoutbreathe.in> <87h6ngs85e.fsf@web.de> <87ttr7nzyj.fsf@breatheoutbreathe.in> <83pm1u6f8l.fsf@gnu.org> <83fs2o2wb0.fsf@gnu.org> <83v8bj2794.fsf@gnu.org> <83r0m70zwp.fsf@gnu.org> <83sf6mzcz6.fsf@gnu.org> Reply-To: Joseph Turner Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33982"; mail-complaints-to="usenet@ciao.gmane.io" Cc: michael_heerdegen@web.de, Eli Zaretskii , philipk@posteo.net, 66187@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 12 22:32:43 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r2I4Q-0008cp-HH for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Nov 2023 22:32:42 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2I47-0005qC-JL; Sun, 12 Nov 2023 16:32:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r2I45-0005pa-Ay for bug-gnu-emacs@gnu.org; Sun, 12 Nov 2023 16:32:21 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r2I45-0007xc-3L for bug-gnu-emacs@gnu.org; Sun, 12 Nov 2023 16:32:21 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r2I4j-0002Hx-Tm for bug-gnu-emacs@gnu.org; Sun, 12 Nov 2023 16:33:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Joseph Turner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Nov 2023 21:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66187 X-GNU-PR-Package: emacs Original-Received: via spool by 66187-submit@debbugs.gnu.org id=B66187.16998247308734 (code B ref 66187); Sun, 12 Nov 2023 21:33:01 +0000 Original-Received: (at 66187) by debbugs.gnu.org; 12 Nov 2023 21:32:10 +0000 Original-Received: from localhost ([127.0.0.1]:57156 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2I3u-0002Gn-1c for submit@debbugs.gnu.org; Sun, 12 Nov 2023 16:32:10 -0500 Original-Received: from out-178.mta1.migadu.com ([2001:41d0:203:375::b2]:54906) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2I3p-0002Gc-LE for 66187@debbugs.gnu.org; Sun, 12 Nov 2023 16:32:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1699824683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Bbswc70lZ674M+mvp7URigCYHyMLpx4+CzQ+i2rAW3Y=; b=YOO3JE8VFf0oN/j4R2RdgG8la1zgG+pxNQxNUNCQqKsv1zNrRK0FqoZsN66YDhFw4XcNZq j4wSROnOnNfasiXuj2ET0BvHhXX+BckCLR7PhU73xYMOK3QBhCGzbj6cTCKflRiA9JnAiF jZVvc5sya4/85gWu6IhUuX5MOuPsjBI= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-reply-to: X-Migadu-Flow: FLOW_OUT X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:274236 Archived-At: --=-=-= Content-Type: text/plain Stefan Monnier writes: >> Then I think we should install your patch on the emacs-29 branch, >> thanks. > > Thanks for the vote of confidence, but as Joseph points out, the patch > isn't actually doing what it says on the tin, so we first have to fix > it :-) Here's another potential solution. While the attached patch seems to work, I'm not sure that minibuffer-completion-confirm should be checked in completion--do-completion instead of completion--complete-and-exit. Thoughts? Thanks! Joseph --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Fix-completing-read-functional-REQUIRE-MATCH-behavio.patch >From 609bf4964f88b01f4843e29b2cf71ee1cd2f6125 Mon Sep 17 00:00:00 2001 From: Joseph Turner Date: Sun, 12 Nov 2023 13:21:50 -0800 Subject: [PATCH] Fix completing-read functional REQUIRE-MATCH behavior * lisp/minibuffer.el (completion--complete-and-exit): If minibuffer-completion-confirm is a function which returns nil, immediately fail to complete. See bug#66187. --- lisp/minibuffer.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 3e30b68d5e9..9fad3e71fad 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1847,10 +1847,13 @@ appear to be a match." ;; Allow user to specify null string ((= beg end) (funcall exit-function)) ;; The CONFIRM argument is a predicate. - ((and (functionp minibuffer-completion-confirm) - (funcall minibuffer-completion-confirm - (buffer-substring beg end))) - (funcall exit-function)) + ((functionp minibuffer-completion-confirm) + (if (funcall minibuffer-completion-confirm + (buffer-substring beg end)) + (funcall exit-function) + (unless completion-fail-discreetly + (ding) + (completion--message "No match")))) ;; See if we have a completion from the table. ((test-completion (buffer-substring beg end) minibuffer-completion-table -- 2.41.0 --=-=-=--