unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Giap Tran <giaptx@mht.vn>
Cc: Stephen Leake <stephen_leake@stephe-leake.org>,
	Stefan Monnier <monnier@IRO.UMontreal.CA>,
	49204@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	[thread overview]
Message-ID: <b8fff5d6-f19c-09aa-d309-0656f06fde82@yandex.ru> (raw)
In-Reply-To: <ac58f9e5-ce06-439f-f4f7-81af0b95fa01@mht.vn>

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.





  reply	other threads:[~2021-07-04  1:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-24  7:17 bug#49204: 28.0.50; How to create new file in project by project-find-file Giáp Trần
2021-06-27  0:07 ` Dmitry Gutov
2021-06-28  2:07   ` Giáp Trần
2021-06-29 13:49     ` Dmitry Gutov
2021-06-30  4:44       ` Giap Tran
2021-07-04  1:07         ` Dmitry Gutov [this message]
2021-07-05  4:03           ` Giap Tran
2021-07-18  0:46             ` Dmitry Gutov
2021-07-19  2:15               ` Giap Tran
2021-07-19 15:20                 ` Juri Linkov
2021-07-20  2:15                   ` Dmitry Gutov
2021-07-20  2:58                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-21  0:29                       ` Dmitry Gutov
2021-07-21  1:34                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-02 11:37                           ` Dmitry Gutov
2021-08-02 13:42                             ` Giap Tran
2021-08-06  0:31                               ` Dmitry Gutov
2021-07-20  2:18                 ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b8fff5d6-f19c-09aa-d309-0656f06fde82@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=49204@debbugs.gnu.org \
    --cc=giaptx@mht.vn \
    --cc=monnier@IRO.UMontreal.CA \
    --cc=stephen_leake@stephe-leake.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).