GNU bug report logs - #49204
28.0.50; How to create new file in project by project-find-file

Previous Next

Package: emacs;

Reported by: Giáp Trần <giaptx <at> mht.vn>

Date: Thu, 24 Jun 2021 10:34:02 UTC

Severity: normal

Found in version 28.0.50

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Giap Tran <giaptx <at> mht.vn>
Cc: Stephen Leake <stephen_leake <at> stephe-leake.org>, Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 49204 <at> debbugs.gnu.org
Subject: bug#49204: 28.0.50; How to create new file in project by project-find-file
Date: Sun, 4 Jul 2021 04:07:29 +0300
On 30.06.2021 07:44, Giap Tran wrote:
> On 6/29/21 8:49 PM, Dmitry Gutov wrote:
>>>
>>
>> Thanks for the explanations. You previously wrote about Projectile. 
>> Does it enable this workflow?
> 
> Yes, as I see projectile support this feature by default (1). I used it 
> before

Thanks for the link.

projectile-find-file doesn't specify any INITIAL-INPUT when calling 
projectile-completing-read, so Projectile seems exempt from this dilemma 
that I described.

>> I wonder how we can reconcile this requirement with the "find name at 
>> point" behavior: we use whatever string at point that looks similar 
>> enough to a file name (or a part of it). To avoid mistakes, we 
>> currently even call completing-read again if the first finished input 
>> doesn't match any files.
>>
>> If the command allows non-matching input, having a default value that 
>> doesn't necessarily match any file names exactly will be a problem. 
>> Moving it from DEFAULT to INITIAL-INPUT shouldn't make a difference 
>> either.
> 
> Thanks for clarifying, I will try to override 
> project--completing-read-strict func when calling completing-read with 
> REQUIRE-MATCH is nil
> 
> (1) - 
> https://github.com/bbatsov/projectile/blob/6b88b69ecd7e6f2b6bbcae0b68026a486be516a4/projectile.el#L1885 

Better than that, you can set project-read-file-name-function to a 
function with the same signature that uses REQUIRE-MATCH=nil.

But I suppose an override for project--completing-read-strict might 
require less code, if you still want to retain the "completion from 
relative names" part of behavior from project--read-file-cpd-relative.

The flip side is someday you might have to deal with breakage when we 
have to make a change to project--completing-read-strict (which is a 
"private" function) or stop using it.

Let me know which approach you choose in the end, and how it works out.




This bug report was last modified 3 years and 350 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.