unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Stephen Leake <stephen_leake@stephe-leake.org>, emacs-devel@gnu.org
Subject: Re: find-file-project
Date: Wed, 16 Sep 2015 20:04:58 +0300	[thread overview]
Message-ID: <55F9A13A.3070101@yandex.ru> (raw)
In-Reply-To: <867fnq1oe9.fsf@stephe-leake.org>

On 09/16/2015 04:31 PM, Stephen Leake wrote:

> I found it convenient for building a project object, and for testing.
> But it is otherwise not used in this patch.

Please build the project objects using the "recursive" approach.

> Except that 'completing-read' does require exactly that. I did try to
> prepend directories for uniquification; it doesn't work. Or at least it
> would require major surgery on completing-read to make it work.

You might have to use a different `category' and set up a 
`completion-category-overrides' entry that would only use 
`partial-completion' as its style.

You'll be able input "/file", and it'll match "foo/bar/file.el". The 
completion table will have to handle the `boundaries' action properly, 
though.

Later, we can even add a new, more permissive style. We could use it in 
other places as well.

>> On the other hand, if I understand it right, I can't type "test unit
>> foo", to see the unit test for foo.
>
> It's not google search.

I'm sure you agree that web search is very handy.

> Can you be more specific? What is the file name you are trying to
> complete to?

Suppose I have ./test/unit/foo_test.rb and ./test/functional/foo_test.rb.

Typing 'unit/foo' or 'functional/foo' would return one or the other. 
Note that trying to uniquify the paths automatically might create 
abbreviations where the user would try to input a path segment fully 
(not in this example, though).

> One thing it should handle but doesn't yet; when presented with:
>
> foo.el<bar> foo.el<baz> foo.el<car>
>
> The user should be able to type <b to narrow to the first two.

Typing bar/foo is more natural than foo.el<bar. Also quicker.

As an added bonus, if you see an unfamiliar file, you'll see its full 
relative path in the completion interface without having to open it.

> There's already a project-find-file.
>
> There are two similarly named functions; one interactive, the other
> dispatching. EDE uses -impl suffix for the latter; that would work here.

If I'm not mistaken, project-find-file, as currently implemented, will 
go away after you use completion tables as described above.

But if not, find-file-in-project is also an adequate name.

>>> More importantly, the result of the completion is treated differently; the
>>> default instance calls locate-file after rearranging the uniquification,
>>> while the global instance calls ceded-gnu-global-call.
>>
>> Why? If we've identified the requested file, let's just open it.
>
> `completing-read' does _not_ return an absolute or unique path. See below.

Well, it could. I wonder if we shouldn't go at it this way:

project-file-completion-table will return a table which returns absolute 
file (and directory) names.

find-file-in-project calls completing-read with that table. However, we 
could have a completing-read-function (now, or add it at some later 
time) which would display completions is some abbreviated fashion 
(shortening the roots, basically).

As a drawback - it might clash with completing-read-function already 
customized by the user. Not sure how to compose or prioritize them.

Alternatively, find-file-in-project could wrap the returned completion 
table in some "abbreviating" one that abbreviates the project roots in 
file paths when displaying them (and possibly abbreviates some file name 
segments as well). Then, after the selection is made, 
find-file-in-project simply expands the root abbreviation. Or, if some 
segments can be abbreviated too, it polls the wrapping table to get the 
original file path (so the table should maintain some correspondence cache).

Not sure if find-file-in-project should looks inside the whole 
search-path; if so, replace "project roots" with "search dirs" above.

Yet another option is simply to make find-file-in-project search only 
within the current project root.

>> This seems to be a good argument against using base file names, and in
>> favor of using full relative paths against project roots, combined
>> with abbreviated roots.
>
> That would add significant clutter to the UI when filenames collide; you
> often don't need the full path to a root to distinguish them.

You probably mean "don't collide". Yes, there will be some visual 
overhead, but this approach is probably the most flexible WRT different 
project structures, and the user can understand easily what's required 
of them. Less so with foo.el<bar.

> And in the global case, the elisp code has no idea what path global is
> using; it must always call global to get an absolute path.

I don't understand. Can't Global return absolute file paths?

> It would make sense to modify completing-read to be able to return
> meta-information with the completion. I looked at that briefly, and I
> have no idea how to go about it.

It must be doable, but we can manage without it.

> You keep ignoring the fact that in some use cases, the available project
> path information is already flat, and has to be converted to
> recursive/ignores. I presented the AdaCore gpr file example.

Maybe it has to, but not in the API.

> In addition, a mix of flat and recursive/ignore is convenient for users
> constructing a path.

Please, let's avoid that kind of complexity in the API. The recursive 
format is more powerful, so we should use just it.



  parent reply	other threads:[~2015-09-16 17:04 UTC|newest]

Thread overview: 162+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-15 20:23 find-file-project Stephen Leake
2015-09-15 22:21 ` find-file-project Dmitry Gutov
2015-09-16  2:49   ` find-file-project Stephen Leake
2015-09-16  3:26     ` find-file-project Stephen Leake
2015-09-16  3:34       ` find-file-project Stephen Leake
2015-09-16  3:38       ` find-file-project Dmitry Gutov
2015-09-16 12:56         ` find-file-project Stephen Leake
2015-09-16 14:37           ` find-file-project Dmitry Gutov
2015-09-16 16:41             ` find-file-project Stephen Leake
2015-09-16 16:59               ` find-file-project Stephen Leake
2015-09-16 17:13                 ` find-file-project Dmitry Gutov
2015-09-16 17:25               ` find-file-project Dmitry Gutov
2015-09-16 21:01                 ` find-file-project Stephen Leake
2015-09-17 17:45                   ` find-file-project Dmitry Gutov
2015-09-18 16:08                     ` project.el semantics Stephen Leake
2015-09-19  0:17                       ` Dmitry Gutov
2015-11-08  1:47                       ` Dmitry Gutov
2015-11-08  7:11                         ` Stephen Leake
2015-11-08 13:07                           ` Dmitry Gutov
2015-11-08 20:11                             ` Dmitry Gutov
2015-11-09  9:10                             ` Stephen Leake
2015-11-09 13:27                               ` Dmitry Gutov
2015-11-09 18:15                                 ` Stephen Leake
2015-11-10  1:32                                   ` Dmitry Gutov
2015-11-10  2:40                                   ` Dmitry Gutov
2015-11-10 17:36                                     ` Stephen Leake
2015-11-11  0:47                                       ` Dmitry Gutov
2015-11-11 10:27                                         ` Stephen Leake
2015-11-11 13:21                                           ` Dmitry Gutov
2015-11-11 16:48                                             ` John Wiegley
2015-11-11 17:03                                               ` Dmitry Gutov
2015-11-11 17:22                                                 ` John Wiegley
2015-11-11 21:46                                                   ` Dmitry Gutov
2015-11-11 22:30                                                     ` John Wiegley
2015-11-12  2:21                                                       ` Dmitry Gutov
2015-11-12 17:26                                                         ` John Wiegley
2015-11-12 17:53                                                           ` Dmitry Gutov
2015-11-12 18:04                                                             ` Dmitry Gutov
2015-11-12 18:17                                                             ` John Wiegley
2015-11-12 18:26                                                               ` John Mastro
2015-11-12 23:37                                                                 ` Dmitry Gutov
2015-11-12 18:50                                                               ` Dmitry Gutov
2015-11-11 22:41                                                   ` Stephen Leake
2015-11-11 22:14                                             ` Stephen Leake
2015-11-11 23:26                                               ` Dmitry Gutov
2015-11-12  6:44                                                 ` Stephen Leake
2015-11-12 11:32                                                   ` Dmitry Gutov
2015-11-12 19:28                                                     ` Stephen Leake
2015-11-12 22:04                                                       ` Dmitry Gutov
2015-11-19  2:21                                                         ` Dmitry Gutov
2015-11-20 18:40                                                           ` John Wiegley
2015-11-21 10:03                                                           ` Stephen Leake
2015-11-21 10:10                                                             ` Stephen Leake
2015-11-22  5:18                                                             ` John Wiegley
2015-11-22  5:36                                                               ` Dmitry Gutov
2015-11-22  5:43                                                                 ` John Wiegley
2015-11-22  5:58                                                                   ` Dmitry Gutov
2015-11-22 16:55                                                                     ` John Wiegley
2015-11-22 17:13                                                                       ` Dmitry Gutov
2015-11-22 19:54                                                                         ` John Wiegley
2015-11-22 21:27                                                                           ` John Wiegley
2015-11-23  1:14                                                                             ` Dmitry Gutov
2015-11-23 22:04                                                                               ` Steinar Bang
2015-11-23 23:17                                                                                 ` Dmitry Gutov
2015-11-23  7:43                                                                             ` Stephen Leake
2015-11-23 12:59                                                                               ` Dmitry Gutov
2015-12-16  4:06                                                                             ` Dmitry Gutov
2015-12-16  6:52                                                                               ` John Wiegley
2015-12-28  4:20                                                                                 ` Dmitry Gutov
2015-11-22 22:04                                                                       ` Stephen Leake
2015-11-22 23:21                                                                         ` Dmitry Gutov
2015-11-23  2:06                                                               ` Richard Stallman
2015-11-22  5:32                                                             ` Dmitry Gutov
2015-11-09 22:16                                 ` John Wiegley
2015-11-10  0:58                                   ` Dmitry Gutov
2015-11-10  1:07                                     ` John Wiegley
2015-11-10  1:18                                       ` Dmitry Gutov
2015-11-10  1:40                                         ` John Wiegley
2015-11-10  3:23                                           ` Dmitry Gutov
2015-11-10  6:00                                             ` John Wiegley
2015-11-10 10:54                                               ` Dmitry Gutov
2015-11-10 14:21                                                 ` John Wiegley
2015-11-10 23:41                                                 ` Stephen Leake
2015-11-11  0:56                                                   ` Dmitry Gutov
2015-11-11  1:17                                                     ` John Wiegley
2015-11-11  1:31                                                       ` Dmitry Gutov
2015-11-11  9:55                                                         ` Stephen Leake
2015-11-11 13:30                                                           ` Dmitry Gutov
2015-11-12  8:46                                                             ` Steinar Bang
2015-11-12 19:35                                                               ` Stephen Leake
2015-11-11  9:44                                                     ` Stephen Leake
2015-11-11 13:39                                                       ` Dmitry Gutov
2015-11-10 17:38                                             ` Stephen Leake
2015-11-10 19:47                                               ` Dmitry Gutov
2015-09-16  4:41     ` find-file-project Dmitry Gutov
2015-09-16 13:04       ` find-file-project Stefan Monnier
2015-09-16 17:01         ` find-file-project Stephen Leake
2015-09-16 13:31       ` find-file-project Stephen Leake
2015-09-16 14:13         ` find-file-project Stephen Leake
2015-09-16 15:05           ` find-file-project Dmitry Gutov
2015-09-16 16:58             ` find-file-project Stephen Leake
2015-09-17 17:15               ` find-file-project Dmitry Gutov
2015-09-18 17:14                 ` project.el semantics Stephen Leake
2015-09-19  0:08                   ` Dmitry Gutov
2015-09-19 12:07                     ` Stephen Leake
2015-09-19 12:40                       ` Dmitry Gutov
2015-09-16 17:04         ` Dmitry Gutov [this message]
2015-09-16 21:11           ` find-file-project Stephen Leake
2015-09-17 17:52             ` find-file-project Dmitry Gutov
2015-09-17  1:26           ` find-file-project Stefan Monnier
2015-09-17 18:09             ` find-file-project Dmitry Gutov
2015-09-18 17:07               ` find-file-project Stefan Monnier
2015-09-18 23:41                 ` find-file-project Dmitry Gutov
2015-09-19  4:13                   ` find-file-project Stefan Monnier
2016-01-06  1:29                 ` find-file-project Dmitry Gutov
2016-01-07  4:52                   ` find-file-project Stefan Monnier
2016-01-07 17:09                     ` find-file-project Dmitry Gutov
2016-01-07  7:12                   ` find-file-project Stephen Leake
2016-01-07 17:55                     ` find-file-project Dmitry Gutov
2016-01-07 18:26                     ` find-file-project Dmitry Gutov
2016-01-07 19:58                       ` find-file-project Stephen Leake
2016-01-07 21:12                         ` find-file-project Dmitry Gutov
2016-01-08 19:11                           ` find-file-project Stephen Leake
2016-01-08 23:49                             ` find-file-project Dmitry Gutov
2016-01-09 12:18                               ` find-file-project Stephen Leake
2016-01-09 17:11                                 ` find-file-project Dmitry Gutov
2016-01-08  1:26                   ` find-file-project John Wiegley
2016-01-08  1:38                     ` find-file-project Dmitry Gutov
2016-01-08  2:19                       ` find-file-project Richard Copley
2016-01-08 11:34                         ` find-file-project Dmitry Gutov
2016-01-08  7:39                       ` find-file-project Stefan Monnier
2016-01-19  6:15                         ` find-file-project Dmitry Gutov
2016-01-19 14:20                           ` find-file-project Stefan Monnier
2016-01-20  0:51                             ` find-file-project Dmitry Gutov
2016-01-20  1:32                               ` find-file-project Stefan Monnier
2016-01-20  1:47                                 ` find-file-project Dmitry Gutov
2016-01-20  2:25                                   ` find-file-project Stefan Monnier
2016-01-20 15:40                                     ` find-file-project Dmitry Gutov
2016-01-20 21:58                                       ` find-file-project Stefan Monnier
2016-01-20 22:12                                         ` find-file-project Dmitry Gutov
2016-01-20 22:17                                           ` find-file-project Drew Adams
2016-01-20 22:26                                             ` find-file-project Dmitry Gutov
2016-01-20 22:48                                               ` find-file-project Drew Adams
2016-01-20 22:50                                                 ` find-file-project Dmitry Gutov
2016-01-20 23:09                                                   ` find-file-project Drew Adams
2016-01-20 23:23                                                     ` find-file-project Dmitry Gutov
2016-01-20 23:46                                                       ` find-file-project Drew Adams
2016-01-20 23:51                                                         ` find-file-project Dmitry Gutov
2016-01-21  0:08                                                           ` find-file-project Drew Adams
2016-01-21  0:21                                                             ` find-file-project Dmitry Gutov
2016-01-21  3:03                                 ` find-file-project Dmitry Gutov
2016-01-21 13:46                                   ` find-file-project Stefan Monnier
2016-01-17 21:23                       ` find-file-project John Wiegley
2016-01-17 21:25                         ` find-file-project Dmitry Gutov
2016-01-17 23:07                           ` find-file-project John Wiegley
2016-01-18  1:42                             ` find-file-project Dmitry Gutov
2015-09-16  7:16   ` find-file-project Eli Zaretskii
2015-09-16 13:06     ` find-file-project Stefan Monnier
2015-09-16 13:40     ` find-file-project Stephen Leake
2015-09-16 14:32       ` find-file-project Eli Zaretskii
2015-09-16 14:57       ` find-file-project Dmitry Gutov
2015-09-16 17:03         ` find-file-project Stephen Leake

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=55F9A13A.3070101@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --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).