From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function Date: Wed, 04 Oct 2023 10:03:54 +0300 Message-ID: <83pm1u6f8l.fsf@gnu.org> 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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32104"; mail-complaints-to="usenet@ciao.gmane.io" Cc: michael_heerdegen@web.de, philipk@posteo.net, 66187@debbugs.gnu.org To: Joseph Turner , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 04 09:05:07 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 1qnvwR-00081F-G3 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 04 Oct 2023 09:05:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnvw5-0006X3-OZ; Wed, 04 Oct 2023 03:04:45 -0400 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 1qnvw4-0006Wu-Jn for bug-gnu-emacs@gnu.org; Wed, 04 Oct 2023 03:04:44 -0400 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 1qnvw4-0000qJ-BN for bug-gnu-emacs@gnu.org; Wed, 04 Oct 2023 03:04:44 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qnvwL-0006ou-Tk for bug-gnu-emacs@gnu.org; Wed, 04 Oct 2023 03:05:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 Oct 2023 07:05: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.169640306326141 (code B ref 66187); Wed, 04 Oct 2023 07:05:01 +0000 Original-Received: (at 66187) by debbugs.gnu.org; 4 Oct 2023 07:04:23 +0000 Original-Received: from localhost ([127.0.0.1]:41382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qnvvi-0006nT-I0 for submit@debbugs.gnu.org; Wed, 04 Oct 2023 03:04:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44020) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qnvvf-0006nC-P3 for 66187@debbugs.gnu.org; Wed, 04 Oct 2023 03:04:20 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnvvH-0006b6-Np; Wed, 04 Oct 2023 03:03:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ksyeBxesaIftzvMmW1FZd0YHipOcF4l4ntiBcI7ZdnA=; b=Git7N1BFj9R4 meSzLIhr1zRe+0V4qPTtOdRmgGNdIrNrcbHQ6G0ZtsepvqAE+mugr5TVCU4Vtg79Kl9em2IKyNGD6 qT0N99PUVZtTAFnNNfsw3o2Jwg12sNBT69xmowCXKZw8kn7GDyo5Rf6SzjueFg7dKgGI5bCYnEv4y 5Ro4NwdARP2VDY8Xgr4kCLrzDHlqlaX9MPD+7ZqSTiMyfNMcXPWARXmev65joDzO+BXLggkQ8q4Uj k14S6r89NP/jBT+xuUuSXzhmAceMvZxUWbs+YuiK2dPJNMw+pil/C1Im/jn/Le/kRSfUEalTisOow 9w8hiicGCAIKgPi8GN5opw==; In-Reply-To: <87ttr7nzyj.fsf@breatheoutbreathe.in> (bug-gnu-emacs@gnu.org) 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:271766 Archived-At: > Cc: philipk@posteo.net, 66187@debbugs.gnu.org > Date: Tue, 03 Oct 2023 14:18:42 -0700 > From: Joseph Turner via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > I dug a little more and realized that the IMO unexpected behavior > resides in completing-read itself. According to the completing-read > docstring, its REQUIRE-MATCH argument can be > > - a function, which will be called with the input as the > argument. If the function returns a non-nil value, the > minibuffer is exited with that argument as the value. > > I incorrectly assumed that this function would prevent matching items > inside COLLECTION for which the function returns nil. What it actually > does it accept input which is not part of COLLECTION if the > REQUIRE-MATCH function returns non-nil. IOW, it doesn't narrow the > potential completion options; it widens them. > > For example, given: > > (completing-read "Prompt: " '("a" "b") nil > (lambda (input) > (string= "a" input))) > > I expected that the prompt would refuse to complete "b". I was wrong. > > Since completing-read is such a fundamental part of Emacs, I doubt it > will be possible to change this behavior. What do you think about the > attached patch to clarify the completing-read docstring? I don't think I see how your proposed change clarifies this issue. Adding Stefan for possibly more comments and ideas.