[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: project--completing-read-strict breaks ada-mode project completion t
From: |
Stephen Leake |
Subject: |
Re: project--completing-read-strict breaks ada-mode project completion table |
Date: |
Tue, 07 May 2019 10:02:14 -0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (windows-nt) |
Stephen Leake <address@hidden> writes:
> Dmitry Gutov <address@hidden> writes:
>
>> Here is my counter-proposal (attached). It both nicely factors out the
>> common-parent-directory logic (which had no place in
>> completing-read-strict anyway) and creates a customization point.
>>
>> You can write a different project-find-file-read-fn that would render
>> the file names differently. For instance, with the alist example, you
>> could build it, call project--completing-read-strict on it, and cdr at
>> the end. Or use a hash-table, etc. Let me know if you need any help
>> with implementing that.
>
> Looks good; I'm testing this now.
This works well for my use cases.
It would be slightly more efficient if `project-find-file-read-fn' took
an 'all-files' arg instead of 'collection' (which is a completion-table
function); I have to do '(all-completions "" collection predicate)' to
get the files list to pass to uniq-file-uniquify.
The downside of that is other read-file-from-list functions might have
to duplicate 'project-file--completion-table' as well. Until we have
another example of this, we can't tell which design is better.
The difference in startup time is not noticeable, so I can live with it.
One nit; 'project-file--completion-table' would be better spelled
'project--file-completion-table'.
Similarly for 'project-find-file--read-cpd-relative'
--
-- Stephe