unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: emacs-devel@gnu.org
Subject: Re: Generation of tags for the current project on the fly
Date: Fri, 12 Jan 2018 20:52:13 +0200	[thread overview]
Message-ID: <8360863o6a.fsf@gnu.org> (raw)
In-Reply-To: <b4d78c72-0153-52f9-54da-68bb5dda0713@yandex.ru> (message from Dmitry Gutov on Fri, 12 Jan 2018 16:52:21 +0300)

> Cc: emacs-devel@gnu.org
> From: Dmitry Gutov <dgutov@yandex.ru>
> 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	other threads:[~2018-01-12 18:52 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12  1:02 Generation of tags for the current project on the fly Dmitry Gutov
2018-01-12  9:01 ` Eli Zaretskii
2018-01-12 13:52   ` Dmitry Gutov
2018-01-12 18:52     ` Eli Zaretskii [this message]
2018-01-14  2:05       ` Dmitry Gutov
2018-01-14 16:21         ` Eli Zaretskii
2018-01-15  1:44           ` Dmitry Gutov
2018-01-15  5:37             ` Eli Zaretskii
2018-01-15 18:50               ` Dmitry Gutov
2018-01-16 17:50                 ` Eli Zaretskii
2018-01-16 21:56                   ` Dmitry Gutov
2018-01-17 15:40                     ` Eli Zaretskii
2018-01-17 19:43                       ` Dmitry Gutov
2018-01-17 20:12                         ` Eli Zaretskii
2018-01-17 22:19                           ` Dmitry Gutov
2018-01-17 22:28                             ` Dmitry Gutov
2018-01-17 22:02                 ` Tom Tromey
2018-01-17 22:44                   ` Dmitry Gutov
2018-01-17 23:20                     ` Tom Tromey
2018-01-18  0:14                       ` Dmitry Gutov
2018-01-18  1:30                         ` Dmitry Gutov
2018-01-19  1:21                         ` Dmitry Gutov
2018-01-20 22:15                           ` Tom Tromey
2018-01-20 23:57                           ` Tom Tromey
2018-01-21 12:26                             ` Dmitry Gutov
2018-01-30  4:45                               ` Tom Tromey
2018-02-04 23:32                                 ` Dmitry Gutov
2018-01-30  5:05                               ` Tom Tromey
2018-02-04 23:40                                 ` Dmitry Gutov
2018-02-05 17:06                                   ` Eli Zaretskii
2018-02-05 20:10                                     ` Dmitry Gutov
2018-02-06 19:36                                       ` Eli Zaretskii
2018-02-06 20:41                                         ` Dmitry Gutov
2018-02-07  3:26                                           ` Eli Zaretskii
2018-02-07  9:47                                             ` Dmitry Gutov
2018-02-07 21:30                                               ` Tom Tromey
2018-02-09  9:41                                                 ` Dmitry Gutov
2018-02-08 20:31                                               ` John Yates
2018-02-09  0:22                                                 ` Dmitry Gutov
2020-12-08 22:26                       ` Dmitry Gutov
2018-01-17 11:08               ` Dmitry Gutov
2018-01-15  1:50           ` John Yates
2018-01-15  5:42             ` Eli Zaretskii
2018-01-15 15:01               ` Dmitry Gutov
2018-01-15 17:21                 ` Eli Zaretskii
2018-01-15 17:45                   ` Dmitry Gutov
2018-01-15 20:56                     ` Matthias Meulien
2018-01-15 21:44                       ` Dmitry Gutov
2018-01-15 16:33               ` John Yates

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=8360863o6a.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=dgutov@yandex.ru \
    --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).