all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
To: emacs-devel@gnu.org
Subject: Re: Unified project interface
Date: Sat, 01 Aug 2015 04:50:47 -0500	[thread overview]
Message-ID: <86lhdvjq14.fsf@stephe-leake.org> (raw)
In-Reply-To: <55BC197C.3050006@yandex.ru> (Dmitry Gutov's message of "Sat, 1 Aug 2015 03:57:32 +0300")

Dmitry Gutov <dgutov@yandex.ru> writes:

> On 07/31/2015 07:13 PM, Stephen Leake wrote:
>
>> Which is faster/friendlier depends on the details, so we'll have to wait
>> for actual implementations. All I'm asking is that we do not make design
>> decisions at the generic project API level that rule out this approach.
>
> We do have to make some decisions, though. For instance, supporting
> both recursive and non-recursive elements in search-path will require
> a separate code path for each function that uses it.
>
> As such, it will require a separate code path in xref-collect-matches
> and an alternative for xref--rgrep-command.

Or they could abort; that would be ok while we are experimenting. It may
be that one or the other will turn out to be The Right Way.

A backend that uses flat paths doesn't have to use those functions. Or,
the people writing that backend can modify them if that seems better
than putting similar code elsewhere. That would be part of the cost of
that design decision.

>> I would provide a special syntax to handle this in
>> project-add-search-path:
>>
>> (defun project-add-search-path (project path &optional make-recursive)
>>    "Add PATH (a list of directories) to the search path for PROJECT.
>>
>> If a directory in PATH ends in \"/**\", also add all directories under
>> that directory.
>>
>> If MAKE-RECURSIVE is non-nil, the full project search path is pruned so
>> that only highest-level directories are present, and all uses of
>> `project-search-path' recurse into subdirectories. In this case, it is
>> likely you will also need to specify ignored directories with
>> `project-add-ignores'.
>>
>> If MAKE-RECURSIVE is nil, uses of `project-search-path' no not recurse
>> into subdirectories."
>> ... )
>>
>> The Ada project files support the ** sytnax.
>>
> This description explains the purpose, but doesn't describe the
> resulting data structure that would hold that information. The ones
> that come to mind are rather ugly.

I have no idea what data structures come to mind for you.

This could be implemented with a root projects type:

(cl-defstruct (projects)
  user-search-path ;; list of directories added to project-search-path
  user-ignores ;; list of ignores added to project-ignores
  recursive-search-path
  ;; if non-nil, project-search-path is treated as recursive in all usees
  ...
  )

Is that "ugly"?

> The /** syntax is rather nifty. But why do you propose to have it and
> MAKE-RECURSIVE at the same time? We could just interpret /** as the
> recursive marker. Then the result could be a list of strings.

Because you never need both. If you are used to using recursive paths,
adding ** in the path to tell the code that will seem odd. So it seems
best to have an explicit flag.

It might be better to specify the recursive flag in the project
constructor; then this function would check it, not set it.

>> This could be handled if the user can explicitly specify project ignores
>> (not just rely on .gitignore etc; git does _not_ ignore the lisp-emacs-*
>> and ada directories). More complicated structures are harder to handle
>> with ignores; you'll end up with a long flat list of ignores, so it
>> might be simpler to have a flat list of includes instead.
>
> I've just started to write about this... Yes indeed, I think every
> flat structure can be translated into path/to/dir, plus path/to/dir/*/
> in the ignores. The translation function shouldn't take too much work
> to write.

The reverse is also true; it is possible to convert recursive
path/ignores into flat path/ignores.

> There's no need to produce the list of ignores manually. 

Only if you ignore the use cases I posted. There are situations where
the algorithm will not do what the user wants.

The fact that you don't like them does not mean they are not valid.

Would it be such a problem to provide 'project-add-ignores'?

>> Me, and many other teams at NASA - structures similar to the above,
>> where the non-included directories can also be release version,
>> debug/release options, target hardware/os option, compiler
>> vendor/version, etc.
>
> There can be different opinions about this. 

Yes, precisely. And Emacs core should not be enforcing any opinions!

>>>> So move it to "location" instead of "xref". The longest journey starts
>>>> with one step ...
>>>
>>> Until it's used in at least two different places, creating a separate
>>> package for it is, I think, premature.
>>
>> Right. We now have those two places; xref-find-definitions,
>> project-find-regexp.
>
> Both still use xref for display. The location values aren't consumed
> by anything else. So that's just one place.

They both display locations. The code that displays locations should
also be in the locations namespace, not the xref one.

-- 
-- Stephe



  reply	other threads:[~2015-08-01  9:50 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-04 11:43 Unified project interface Dmitry Gutov
2015-06-04 14:40 ` Stephen Leake
2015-06-05  0:08   ` Dmitry Gutov
2015-06-05 10:08     ` Stephen Leake
2015-06-05 13:03       ` Stephen Leake
2015-06-05 13:14         ` Dmitry Gutov
2015-06-08  1:24           ` Stephen Leake
2015-06-09 18:16             ` Dmitry Gutov
2015-06-09 18:21               ` Eli Zaretskii
2015-06-09 18:49                 ` Dmitry Gutov
2015-06-09 19:03                   ` Eli Zaretskii
2015-06-07 23:22         ` Dmitry Gutov
2015-06-08  1:35           ` [SPAM UNSURE] " Stephen Leake
2015-06-09 19:04             ` Dmitry Gutov
2015-06-07 23:15       ` Dmitry Gutov
2015-06-08  1:59         ` Stephen Leake
2015-06-09 22:31           ` Dmitry Gutov
2015-06-10  7:13             ` Steinar Bang
2015-07-08  0:25             ` Dmitry Gutov
2015-07-11 13:43               ` Bozhidar Batsov
2015-07-11 14:17                 ` Dmitry Gutov
2015-07-12 14:42                   ` Dmitry Gutov
2015-07-13  8:49                   ` Bozhidar Batsov
2015-07-13 10:23                     ` Dmitry Gutov
2015-07-24 23:43       ` Dmitry Gutov
2015-07-25  0:55         ` Stephen Leake
2015-07-25  7:29           ` Eli Zaretskii
2015-07-26  2:12             ` Dmitry Gutov
2015-07-26  2:45               ` Eli Zaretskii
2015-07-26 11:25               ` Stephen Leake
2015-07-26  2:11           ` Dmitry Gutov
2015-07-26 11:22             ` Stephen Leake
2015-07-26 17:23               ` Dmitry Gutov
2015-07-26 18:57                 ` Stephen Leake
2015-07-26 23:56                   ` John Yates
2015-07-27  1:49                     ` Dmitry Gutov
2015-07-27 11:12                     ` Stephen Leake
2015-07-27 11:27                       ` Dmitry Gutov
2015-07-27 13:00                   ` Dmitry Gutov
2015-07-27 13:02                     ` Dmitry Gutov
2015-07-28  1:21                     ` Stephen Leake
2015-07-28 11:05                       ` Stephen Leake
2015-07-28 14:33                         ` Dmitry Gutov
2015-07-28 15:45                           ` Stephen Leake
2015-07-28 16:25                             ` Dmitry Gutov
2015-07-29  1:36                               ` Stephen Leake
2015-07-29  2:10                                 ` Dmitry Gutov
2015-07-28 14:18                       ` Dmitry Gutov
2015-07-28 16:15                         ` Stephen Leake
2015-07-28 18:44                           ` Dmitry Gutov
2015-07-29  2:27                             ` Stephen Leake
2015-07-29 22:51                               ` Dmitry Gutov
2015-07-30  8:17                                 ` Stephen Leake
2015-07-31  0:15                                   ` Dmitry Gutov
2015-07-31 16:13                                     ` Stephen Leake
2015-08-01  0:57                                       ` Dmitry Gutov
2015-08-01  9:50                                         ` Stephen Leake [this message]
2015-08-01 10:51                                           ` Stephen Leake
2015-08-01 12:42                                             ` Dmitry Gutov
2015-08-01 12:40                                           ` Dmitry Gutov
2015-08-01 14:15                                             ` Stephen Leake
2015-08-01 15:09                                               ` Dmitry Gutov
2015-08-01 19:04                                                 ` Stephen Leake
2015-08-01 22:33                                                   ` Dmitry Gutov
2015-08-01  1:14                                       ` Per-language project-search-path, was: " Dmitry Gutov
2015-08-01 10:43                                         ` Stephen Leake
2015-08-01 14:12                                           ` Dmitry Gutov
2015-08-01 18:57                                             ` Stephen Leake
2015-08-02  0:25                                               ` Dmitry Gutov
2015-08-02  2:29                                             ` Eric Ludlam
2015-08-02  8:57                                               ` Nix
2015-08-02 17:14                                                 ` Michael Heerdegen
2015-08-02 23:09                                                   ` Eric Ludlam
2015-08-02 23:39                                                     ` Michael Heerdegen
2015-08-03 11:33                                                       ` Eric Ludlam
2015-08-02 23:07                                                 ` Dmitry Gutov
2015-08-03 10:24                                                   ` Nix
2015-08-03 10:35                                                     ` Dmitry Gutov
2015-08-07 15:25                                                       ` Nix
2015-08-03  1:21                                               ` Dmitry Gutov
2015-07-29 23:11                               ` xref display and multiple locations, " Dmitry Gutov
2015-06-06 10:20 ` Bozhidar Batsov
2015-06-06 10:29   ` Dmitry Gutov
2015-06-06 12:32 ` Eric Ludlam
2015-06-06 18:44   ` Dmitry Gutov
2015-06-06 19:28     ` Eli Zaretskii
2015-06-07 22:29       ` 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

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

  git send-email \
    --in-reply-to=86lhdvjq14.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 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.