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, 24 Sep 2023 22:12:18 -0700 Message-ID: <875y3yx221.fsf@breatheoutbreathe.in> References: <87r0mni6m1.fsf@breatheoutbreathe.in> <87bkdq3nw6.fsf@web.de> Reply-To: Joseph Turner Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7985"; mail-complaints-to="usenet@ciao.gmane.io" Cc: philipk@posteo.net, 66187@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 25 07:20:11 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 1qke0w-0001to-L4 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 25 Sep 2023 07:20:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qke0f-00044h-VA; Mon, 25 Sep 2023 01:19:53 -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 1qke0d-00044G-6Z for bug-gnu-emacs@gnu.org; Mon, 25 Sep 2023 01:19:51 -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 1qke0c-0008RI-EB for bug-gnu-emacs@gnu.org; Mon, 25 Sep 2023 01:19:50 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qke0o-0001iS-8N for bug-gnu-emacs@gnu.org; Mon, 25 Sep 2023 01:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Joseph Turner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Sep 2023 05:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66187 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: Philip Kaludercic , "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors" , 66187@debbugs.gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16956191916567 (code B ref -1); Mon, 25 Sep 2023 05:20:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Sep 2023 05:19:51 +0000 Original-Received: from localhost ([127.0.0.1]:43914 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qke0c-0001hq-KU for submit@debbugs.gnu.org; Mon, 25 Sep 2023 01:19:50 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:48020) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qke0Y-0001hR-3z for submit@debbugs.gnu.org; Mon, 25 Sep 2023 01:19:48 -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 1qke0G-000438-2C for bug-gnu-emacs@gnu.org; Mon, 25 Sep 2023 01:19:28 -0400 Original-Received: from out-190.mta1.migadu.com ([95.215.58.190]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qke0D-0008PF-6k for bug-gnu-emacs@gnu.org; Mon, 25 Sep 2023 01:19:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1695619162; 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=DpKvFXlK3Vw32LYUlt20JNit00C8Y/h3Lj5hz9CFNEM=; b=NfL8Va7M+ZnFXY9Zl0NjrD4eOVOCNR4tzONsXrLx4yIVhfxH5T0hIn3oU3Ol192TKXc0IH Ktw6LK3XIblhWOU0R7uqQ6/BU5xiwzPxf7LnCV0vXHL7o2aK8jED22vMUEpoZ/clet+A3V y5JMi+hpeMKdBh73FkpuKZ+JDD/ICjY= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-reply-to: <87bkdq3nw6.fsf@web.de> X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=95.215.58.190; envelope-from=joseph@breatheoutbreathe.in; helo=out-190.mta1.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:271294 Archived-At: Thanks for your help!! Michael Heerdegen writes: > Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of > text editors" writes: > >> Would someone kindly explain the intended behavior here? > > I don't know, but I would expect that when the MUST-MATCH predicate > fails the behavior is the same as with MUST-MATCH t, and when it > succeeds, the behavior is like MUST-MATCH nil. Quite simple I think. > Do you see something different? Yes. In emacs -Q: (mkdir "/tmp/foo" t) (with-temp-buffer (write-file "/tmp/foo/bar")) (setq default-directory "/tmp/foo/") (read-file-name "Clone into new or empty directory: " nil nil (lambda (filename) (or (not (file-exists-p filename)) (directory-empty-p filename))) nil (lambda (filename) (file-directory-p filename))) The default prompt is "/tmp/foo/". In my Emacs (29.0.92), when I immediately press RET, read-file-name (erroneously?) returns "/tmp/foo/" (which exists and is not empty) instead of saying "[Match required]". Are you able to reproduce this on your machine? > Hmm - or, maybe the confusion is about the behavior for the members of > the collection? With other words, whether the argument can be used to > restrict which existing files are matched, vs. whether it can only be > used to limit what additionally matches? AFAIU the latter is the case - > existing files always match. > >> This issue originally came up in this thread about package-vc-checkout: >> https://yhetil.org/emacs-bugs/87v8bzi7iz.fsf@breatheoutbreathe.in/T/#m224de986dcc97f23e17386fb0dd2db4a513726bf > > I didn't understand the "this erroneously returns the default filename" > part. What default filename is returned? Does my above comment answer this question? Thank you!! Joseph