unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Making project-files the "canonical" generic
Date: Mon, 14 Jan 2019 17:14:41 -0800	[thread overview]
Message-ID: <86a7k2rabi.fsf@stephe-leake.org> (raw)
In-Reply-To: <08de4d90-d678-0524-9356-f9a3515bf0c4@yandex.ru> (Dmitry Gutov's message of "Sun, 13 Jan 2019 03:54:32 +0300")

Dmitry Gutov <dgutov@yandex.ru> writes:

> On 12.01.2019 21:53, Stephen Leake wrote:
>
>>> Did you end up ever using it and/or integrating it with ada-mode,
>>
>> Yes, but not yet in the ELPA version; I had been maintaining Emacs 24
>> compatibility there. That's now dropped, so I can use Emacs 25 functions
>> in future ada-mode releases.
>
> Very good. If you don't mind sharing a link to the development repo,
> that would be great.

My ada-mode project stuff is not in a publicly accessible repo at the
moment. I guess it's time to fix that.

>>> If so, do you see any particular benefits in keeping
>>> project-file-completion-table a generic function instead of
>>> reimplementing it on top of the (somewhat) newly added project-files
>>> generic?
>>
>> It seems to me a completion table is more useful than a simple file
>> list; what is the use case for project-files? I've been vaguely
>> following the multifile.el discussion, but I don't remember seeing this.
>
> What is your use for completion table? I mean, the ability to provide
> your implementation. The default implementation should already work if
> project-roots and project-ignores return the correct values.

In my case, they don't; as I have said elsewhere, the Ada compiler tools
require flat paths, so the Ada project code doesn't use project-roots,
project-ignores. I have code that converts between the two, but calling
that for every use of project-files would be inefficient.

Providing a more flexible definition of project-path would fix that
problem.

> The only big reason to do that that I know of, is to use a cached list
> of files (or somehow fetch it quickly another way, without 'find').
> But project-files is just as suitable for that.

I could override project-files to return the correct list.

The completion table style I use does uniquification by appending enough
parent directories to make the file names unique (same as
uniquify-buffer-name-style post-forward-angle-brackets). I might be able
to make that work with the list returned by project-files, but currently
some of the work is done in the completion table code itself, as it is
traversing the directory path. When I wrote it, I tried but did not
succeed in keeping all the completion-style-dependent code out of the
table. Maybe things have changed.

The completion table is also lazy, in the sense that typing characters
in the completion buffer interrupts computation of the table, and it is
later resumed properly. I'm not sure "lazy" is the right term for this;
perhaps "interruptible"? I'm not clear if that mechanism would work thru
project-files.

>> I don't have a use-case for project-files, so I'd rather keep the status
>> quo.
>
> project-files is now used for project-find-file, and will be used for
> project-find-regexp as well.

? not in master as of 492ab1136860ef41c33a5e35a85fb721693f892b, fetched
today.

> The thing about it is, project-files is easier to implement. So if we
> don't have a particular reason for the backend author to provide their
> own completion table entirely, we don't need to allow that.

Yes, that makes sense. 

>> Do we have any examples of that? find-file works
>> that way, but it's not a completion table.
>
> ecomplete-completion-table is the one example that I found quickly,
> but there are probably more.

ok, so there are real examples that require project-files and
project-file-completion-table to be independent of each other.

And the user interface experience for completion tables is not fully
determined by completion-styles-alist, so my uniquifying completion
table above is not really an outlier.

>> Requiring project-file-completion-table to be implemented on top of
>> project-files prevents such non-flat completion tables, and also lazy
>> completion tables (the ada-mode completion table is flat and lazy).
>> Allowing user choice in completion tables is important.
>
> Could you clarify about laziness?

See above.

>> It seems to me that the default implementation of project-files should
>> _not_ use project-file-completion-table, because it could easily be
>> incorrect (it should use "find" directly). It is up to the project
>> backend to ensure the two functions return consistent results.
>
> If possible, I'd like to avoid this completion, and only have one of
> the other. After all, defining project-files on top of non-flat
> completion tables is also possible (I'm told), if not particularly
> easy.

But defining a non-flat table on top of project-files is not possible,
or at least very inefficient (you'd have to throw away all the nested
directory content).

So I don't think your goal is possible.

Low level facilities like project.el should enable _all_ possible use
cases, not rule out some in the name of simplicity.

I have no objection to the default implemention of
project-file-completion-table using project-files, but I don't think we
should eliminate the generic function.

Completion tables are a powerful feature of Emacs; we should not
restrict their use with projects.

-- 
-- Stephe



  reply	other threads:[~2019-01-15  1:14 UTC|newest]

Thread overview: 103+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180922154639.23195.66360@vcs0.savannah.gnu.org>
     [not found] ` <20180922154640.9D58220310@vcs0.savannah.gnu.org>
2018-12-26  3:34   ` [Emacs-diffs] master 55ec674: * lisp/multifile.el: New file, extracted from etags.el Dmitry Gutov
2018-12-26 20:13     ` Stefan Monnier
2018-12-27  1:49       ` Dmitry Gutov
2018-12-27 14:39         ` Stefan Monnier
2018-12-28  3:45           ` Dmitry Gutov
2018-12-31 11:42             ` Dmitry Gutov
2018-12-31 15:12               ` Eli Zaretskii
2019-01-02 23:47                 ` Dmitry Gutov
2019-01-02  1:49               ` Stefan Monnier
2019-01-03  0:41                 ` Dmitry Gutov
2019-01-02 21:53               ` Juri Linkov
2019-01-02 23:02                 ` Dmitry Gutov
2019-01-03  0:37                   ` Juri Linkov
2019-01-03 11:45                     ` Dmitry Gutov
2019-01-03 20:53                       ` Juri Linkov
2019-01-06  1:22                         ` Dmitry Gutov
2019-01-07 23:22                           ` Dmitry Gutov
2019-01-07 23:27                             ` Dmitry Gutov
2019-01-08 14:21                             ` Michael Albinus
2019-01-08 23:06                               ` Dmitry Gutov
2019-01-09  8:10                                 ` Michael Albinus
2019-01-09 15:24                                   ` Dmitry Gutov
2019-01-09 14:57                             ` Dmitry Gutov
2019-01-09 23:15                               ` Juri Linkov
2019-01-10 10:20                                 ` Dmitry Gutov
2019-01-10 21:41                                   ` Juri Linkov
2019-01-12  1:48                                     ` Dmitry Gutov
2019-01-18  3:52                 ` Dmitry Gutov
2019-01-18 12:49                   ` Stefan Monnier
2019-01-18 19:28                     ` Dmitry Gutov
2019-01-18 21:11                       ` Stefan Monnier
2019-01-18 22:53                         ` Dmitry Gutov
2018-12-29  0:27           ` Dmitry Gutov
2018-12-29 17:09             ` Dmitry Gutov
2018-12-29 21:54               ` Juri Linkov
2018-12-30 23:06                 ` Dmitry Gutov
2019-01-02  1:48                 ` Stefan Monnier
2019-01-02 22:05                   ` Juri Linkov
2019-01-03  3:44                     ` Stefan Monnier
2019-01-03 20:45                       ` Juri Linkov
2019-01-12  1:10           ` Making project-files the "canonical" generic, was: " Dmitry Gutov
2019-01-12 18:53             ` Making project-files the "canonical" generic Stephen Leake
2019-01-13  0:54               ` Dmitry Gutov
2019-01-15  1:14                 ` Stephen Leake [this message]
2019-01-16 16:38                   ` Stefan Monnier
2019-01-17  2:23                     ` Dmitry Gutov
2019-01-17 13:25                       ` Stefan Monnier
2019-01-18  1:00                         ` Dmitry Gutov
2019-01-16 19:02                   ` project--completing-read-strict breaks ada-mode project completion table Stephen Leake
2019-01-16 22:02                     ` Stephen Leake
2019-01-17 23:17                       ` Stephen Leake
2019-01-18  2:04                         ` Dmitry Gutov
2019-01-19  3:35                           ` Stephen Leake
2019-01-19 22:05                             ` Dmitry Gutov
2019-01-20 19:34                         ` Stephen Leake
2019-01-17  2:21                     ` Dmitry Gutov
2019-01-17 13:55                       ` Stefan Monnier
2019-01-17 21:35                         ` John Yates
2019-01-18  2:19                         ` Dmitry Gutov
2019-01-18  3:05                           ` Stefan Monnier
2019-01-19  0:26                             ` Dmitry Gutov
2019-01-21 19:32                           ` Stephen Leake
2019-01-22  0:09                             ` Dmitry Gutov
2019-02-07  1:20                             ` Stephen Leake
2019-02-11 21:50                               ` Stefan Monnier
2019-02-12  1:31                                 ` Stephen Leake
2019-02-15 15:50                                   ` Stephen Leake
2019-02-15 22:47                                     ` Stephen Leake
2019-02-15 23:38                                       ` Stephen Leake
2019-04-19 17:49                                     ` Stephen Leake
2019-05-03  0:48                                       ` Dmitry Gutov
2019-05-04 10:39                                         ` Stephen Leake
2019-05-07 18:02                                           ` Stephen Leake
2019-05-07 22:35                                             ` Dmitry Gutov
2019-05-08  1:53                                               ` Stefan Monnier
2019-05-14  2:14                                                 ` Dmitry Gutov
2019-05-14  2:13                                             ` Dmitry Gutov
2019-02-19 17:45                                   ` Stefan Monnier
2019-02-20 19:58                                     ` Stephen Leake
2019-02-21  2:00                                       ` Stefan Monnier
2019-01-21 19:36                           ` Stephen Leake
2019-01-22  0:20                             ` Dmitry Gutov
2019-01-17  3:04                   ` Making project-files the "canonical" generic Dmitry Gutov
2018-12-27 20:33         ` [Emacs-diffs] master 55ec674: * lisp/multifile.el: New file, extracted from etags.el Juri Linkov
2018-12-27 23:31           ` Dmitry Gutov
2018-12-27 23:45             ` Juri Linkov
2018-12-28  6:04               ` Dmitry Gutov
2018-12-28 18:07           ` Stefan Monnier
2018-12-29  0:31             ` Dmitry Gutov
2018-12-29 22:02             ` Juri Linkov
2018-12-30 23:13               ` Dmitry Gutov
2019-01-02 22:11                 ` Juri Linkov
2019-01-02 23:23                   ` Dmitry Gutov
2019-01-03  0:44                     ` Juri Linkov
2019-01-03 11:52                       ` Dmitry Gutov
2019-01-03 15:35                         ` Stefan Monnier
2019-01-03 23:06                           ` Dmitry Gutov
2019-02-07 12:23                             ` Dmitry Gutov
2019-02-07 13:05                               ` Stefan Monnier
2019-02-14  1:11                                 ` Dmitry Gutov
2019-01-03 20:57                         ` Juri Linkov
2019-01-03 23:21                           ` Dmitry Gutov
2019-01-05 22:12                             ` Juri Linkov

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=86a7k2rabi.fsf@stephe-leake.org \
    --to=stephen_leake@stephe-leake.org \
    --cc=emacs-devel@gnu.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).