emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generation of tags for the current project on the fly


From: Eli Zaretskii
Subject: Re: Generation of tags for the current project on the fly
Date: Fri, 12 Jan 2018 20:52:13 +0200

> Cc: address@hidden
> From: Dmitry Gutov <address@hidden>
> Date: Fri, 12 Jan 2018 16:52:21 +0300
> 
> On the other hand, code navigation and editing are often fairly distinct 
> activities, you don't switch between the two too frequently.

In my workflows, I do that all the time, because I don't always
remember the details of the functions I need to call in the code I'm
writing.

> >    . we fail to find a tag
> 
> Not sure about this one. We can make this customizable, of course 
> (although the implementation might end up a bit convoluted), but IMO 
> it's not good for the default behavior.
> 
> Failing to find a tag is a valid result (some identifiers can be absent, 
> or defined somewhere else, e.g. in the libraries), and doing a rescan 
> each time that happens might be more annoying.

If you maintain that scanning is fast, then the annoyance should be
minimal.

> > We could offer generating a tags table if we don't find one in the
> > tree, instead of generating it automatically.
> 
> And then what? Visit it?

No, just do what you intended, but only after an approval.  It could
be that the user thought she already visited a tags table, or some
other mistake.

> >> For reference, indexing the Emacs sources takes ~1.1sec here.
> > 
> > Was that with cold cache or warm cache?
> 
> Warm, probably. But that's the relevant time, isn't it?

Not necessarily.  The first time a tree is scanned could well be the
shortly after you start working on a project.

> We're most wondering how long it will take to *reindexing* (because
> we're discussing when to do it). The first indexing will take place
> anyway.
> 
> > "make TAGS" takes about 9 sec here with a warm cache, and this is an
> > SSD disk.
> 
> 'make tags' makes 1 second on my machine, with an NVMe disk.

I bet it will be even faster with a RAM disk.  But we shouldn't base
our decisions on such configurations, as that isn't the norm yet, I
think.

> > IOW, I don't think this is so fast that we could do that without user
> > approval.
> 
> The argument here is that if the user called xref-find-definitions, it's 
> better to do a (long-ish) scan and show something, instead of failing. 

It could be a mistake, or the user could reconsider given the
question.  We do that with visiting large files, for example.

> > I don't understand why you didn't use the commonly used form:
> > 
> >     find . -name "*.rb" -o -name "*.js" ... | etags -o- -
> 
> Because the project API doesn't make this easy. Anyway, generating the 
> full list of files is relatively fast in comparison.

Invoking 'find' will always be faster, as it's optimized for
traversing directory trees.

> > I think
> > using 'find' is also faster.
> 
> find is used under the covers. The difference is just that the 
> invocations of etags are only happening later.

No, the difference is also that in my example etags runs in parallel
with 'find', not in sequence.

> > More generally, I think doing this that way is not TRT, at least not
> > by default.  "make TAGS" in Emacs will produce a much richer tags
> > table than your method, because our Makefiles use regexps to augment
> > the automatic tagging in etags.  So I think we should first try to
> > invoke the TAGS target of a Makefile in the tree, if one exists, and
> > only use the naïve command as fallback.
> 
> 'make tags' is very much specific to Emacs.

No, TAGS is a standard target in GNU Makefile's.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]