From: Dmitry Gutov <dgutov@yandex.ru>
To: John Yates <john@yates-sheets.org>,
Emacs developers <emacs-devel@gnu.org>
Subject: Re: Can project.el or projectile.el help? How about completion?
Date: Mon, 1 Nov 2021 16:48:20 +0300 [thread overview]
Message-ID: <6a3bcb26-dde5-39d4-0514-7d155be646f3@yandex.ru> (raw)
In-Reply-To: <CAJnXXoj3xQXoO8veCsLGcnKwHWOEJf2KKzZnOLD+Mo+8quwfJA@mail.gmail.com>
Hi!
On 31.10.2021 21:48, John Yates wrote:
> I work on a large corporate mono-repo in which numerous
> filenames occur repeatedly. Further, various directories
> above such duplicates also have duplicated names.
First of all, project-find-files by default uses 'substring' completion.
Which can allow you to type unique parts of the relative file name,
separated by slashes, press TAB, and then see the name completed.
Completion frameworks like Ivy/Helm/Consult can also affect/augment the
completion experience.
> Currently I use a self-built emacs tool to index this space:
> * Build a map from a unique filename to a set of
> repo-relative directory paths to files with that name
> * Compute a disambiguation string for completing reads
> for unique filenames this string is empty; otherwise:
> * Repeatedly strip identical leading directories
> * Repeatedly strip identical trailing directories
>
> I would like to replace this tool with something like
> project.el or projectile.el. So the first question is does
> either package do anything intelligent when filenames
> are duplicated? If so, what?
project.el also comes with defcustom called
project-read-file-name-function. It allows you to write your own wrapper
which could convert all files names into "disambiguating strings", for
ease of completion, before the completion prompt is displayed.
> Then, is there any completion package that can present
> the candidates in an order reflecting their distance from
> the current buffer's working directory? My thought is to
> sort identically named candidates by their repo-relative
> paths. A focused, incrementally widening presentation
> of candidates would show initially those in or below the
> current working directory. Each time instructed to widen
> the presentation it would advance up the parent directory
> chain, showing candidates in or below that directory.
Since project-read-file-name-function creates the completion table
object, you could sort the strings inside it as well, using the
algorithm of your choice. As long as the table defines
`display-sort-function', the completion UIs should not re-sort the list
alphabetically.
prev parent reply other threads:[~2021-11-01 13:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-31 18:48 Can project.el or projectile.el help? How about completion? John Yates
2021-11-01 0:39 ` Stephen Leake
2021-11-01 12:20 ` Bozhidar Batsov
2021-11-01 13:48 ` Dmitry Gutov [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6a3bcb26-dde5-39d4-0514-7d155be646f3@yandex.ru \
--to=dgutov@yandex.ru \
--cc=emacs-devel@gnu.org \
--cc=john@yates-sheets.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.