From: Dmitry Gutov <dgutov@yandex.ru>
To: Tom Tromey <tom@tromey.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
john@yates-sheets.org, philipk@posteo.net, emacs-devel@gnu.org
Subject: Re: Automatic (e)tags generation and incremental updates
Date: Sun, 10 Jan 2021 15:53:10 +0200 [thread overview]
Message-ID: <1e9c9572-52ee-339b-78a2-731b9eb5f3de@yandex.ru> (raw)
In-Reply-To: <875z45dbm7.fsf@tromey.com>
Hi Tom,
On 09.01.2021 23:49, Tom Tromey wrote:
> Dmitry> - Call some xref command like 'M-.'. See message "Generating new tags
> Dmitry> table..." (it's saved in /tmp/...), then see navigation happen.
>
> On "xdg"-ish systems, it would make sense to use the XDG cache directory
> here.
I should look into this later. If we end up using putting TAGS files
into prject directories (see below), that will be moot.
> Dmitry> - Pressing C-M-i instead should also trigger tags table generation.
>
> Dmitry> - When you switch between projects, the previously generated tags
> Dmitry> tables are discarded. It's not too hard to improve, but that would
> Dmitry> involve some choices/tradeoffs.
>
> What are the tradeoffs?
There are several questions.
- Do we want to store the generated files openly in the root directories
of each project? I.e. save them as TAGS. That might look more
familiar/comfortable by the old-timers, and some users might even
pre-generate such files, if the process takes a long time. And the
contents will be able to reliably survive for a long time. Storing them
with "garbled" names somewhere in /tmp of XDG cache risks having to
fully renenerate the indexes at least every time the machine reboots.
The downside to creating TAGS files is it's unfamiliar to newcomers who
usually expect index cache to be hidden, and they'll have to either
update .gitignore or risk checking them in.
I don't see a lot of the old timers in this discussion now, and most
existing users of etags are likely satisfied with the current workflow,
so perhaps that kind of familiarity is not important. So it probably
comes down to being able to generate such files only once per project,
and only update them later. I'm not such what size of project that will
become a significant advantage at, but it's likely that at that point
etags.el's other performance limitation will come into play. We'll need
some real feedback on that. Until then, the generated files will stay in
/tmp. Might even keep them off disk entirely, actually, though that
would require some changes to etags.el (help welcome).
- Do we keep such file in memory every time after the user has switched
to a different project (and, say, maintain a {project -> file} alist in
memory), or close and reopen upon switching. If the files are stored on
disk, implementing the latter is plainly easier with the current
etags.el code. Is eliminating the delay worth the code complexity and
increased memory usage?
- Being able to pick up an old TAGS depends on our ability to compare
the current project contents against a list of files and one timestamp
(TAGS modification datetime) quickly, much quicker than simply
regenerating such file would take. And if we can't, there's no point in
keeping them around.
> I tend to think that conceptually each buffer should point to its
> corresponding tags table. Then some separate logic could be used to
> decide when to kill some tag file buffer.
Ideally, perhaps, etags.el would provide an interface for polling a
specific tags table (for completions or locations) by simply binding one
or two local variables. At the moment, though, the route there seems to
be through file-local variables and through calling visit-tags-table
with non-nil second argument.
> Dmitry> - When files are deleted, or otherwise changed outside of Emacs
> Dmitry> (perhaps with 'git checkout'), nothing is updated. I have a few new
> Dmitry> ideas, haven't started on them yet. Workaround: toggle
> Dmitry> etags-regen-mode off and on, which will result in full rescan when you
> Dmitry> use 'M-.'.
>
> It seems to me that the default ought to be to update the tags table on M-.
> One nice way to do this would be to run etags in the background, so that
> the work of updating would be done in parallel with the user typing,
> since presumably you'd want to ensure that etags has finished before
> jumping to the result (or fulfilling a completion request).
It sounds clever, but UUIC that would only benefit users who call M-.
with C-u or who have customized xref-prompt-for-identifier to t. Even
among those, it would only be able to help (without sacrificing
correctness) only those who don't use something like icomplete-mode for
tag input. Because the completion table already depends on the tags
index (which is out of date). On the flip side, even when the tags
generation is synchronous, you can start typing right away.
If general, doing updates when Emacs is idle and/or asynchronously are
quality-of-life changes that can come later after we improve correctness
(i.e. make sure the index is up to date even after external changes).
Doing that will require some more processing implemented in Elisp which
can still create annoying stutters in Emacs, whether the process calls
are asynchronous or not. Debugging those and working on algorithmic
complexity there is easier when work happens at predictable points in
time. Asynchronous calls also make error handling more difficult (and
the current Emacs threads -- even more so).
next prev parent reply other threads:[~2021-01-10 13:53 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-14 3:36 Automatic (e)tags generation and incremental updates Dmitry Gutov
2021-01-07 3:46 ` Dmitry Gutov
2021-01-07 14:15 ` Eli Zaretskii
2021-01-07 15:56 ` Dmitry Gutov
2021-01-07 16:17 ` Stefan Kangas
2021-01-09 21:49 ` Tom Tromey
2021-01-10 13:53 ` Dmitry Gutov [this message]
2021-01-10 16:56 ` Tom Tromey
2021-01-10 19:39 ` Tom Tromey
2021-01-10 23:09 ` Dmitry Gutov
2021-01-10 23:36 ` Dmitry Gutov
2021-01-10 23:50 ` Dmitry Gutov
2021-01-11 14:56 ` Eli Zaretskii
2021-01-12 1:33 ` Dmitry Gutov
2021-01-12 4:21 ` Stefan Monnier
2021-01-12 16:59 ` Dmitry Gutov
2021-01-12 17:24 ` Stefan Monnier
2021-01-12 15:08 ` Eli Zaretskii
2021-01-12 16:48 ` Dmitry Gutov
2021-01-12 17:15 ` Eli Zaretskii
2021-01-12 17:32 ` Dmitry Gutov
2021-01-12 17:55 ` Eli Zaretskii
2021-01-12 22:26 ` Dmitry Gutov
2021-01-13 15:01 ` Eli Zaretskii
2021-01-13 15:52 ` Dmitry Gutov
2021-01-13 15:58 ` Eli Zaretskii
2021-01-16 3:57 ` Dmitry Gutov
2021-01-16 7:34 ` Eli Zaretskii
2021-01-10 16:49 ` Eli Zaretskii
2021-01-10 16:58 ` Tom Tromey
2021-01-10 17:56 ` Dmitry Gutov
2021-01-10 18:14 ` Eli Zaretskii
2021-01-10 23:13 ` Dmitry Gutov
2021-01-11 14:53 ` Eli Zaretskii
2021-01-12 1:49 ` Dmitry Gutov
2021-01-12 15:09 ` Eli Zaretskii
2021-02-18 23:26 ` Dmitry Gutov
2021-02-19 8:33 ` Eli Zaretskii
2021-02-19 14:35 ` Dmitry Gutov
2021-02-19 15:44 ` Eli Zaretskii
2021-02-20 1:35 ` Dmitry Gutov
2021-02-20 7:30 ` Eli Zaretskii
2021-02-20 20:27 ` Dmitry Gutov
2021-02-20 20:41 ` Eli Zaretskii
2021-02-20 21:05 ` Dmitry Gutov
2021-02-20 21:14 ` Dmitry Gutov
2021-02-21 19:53 ` Eli Zaretskii
2021-02-21 20:39 ` Dmitry Gutov
2021-02-22 16:08 ` Eli Zaretskii
2021-02-22 19:25 ` Dmitry Gutov
2021-02-22 19:33 ` Eli Zaretskii
2021-02-23 1:15 ` 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
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=1e9c9572-52ee-339b-78a2-731b9eb5f3de@yandex.ru \
--to=dgutov@yandex.ru \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=john@yates-sheets.org \
--cc=philipk@posteo.net \
--cc=tom@tromey.com \
/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).