[Top][All Lists]

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

xref and leaving "temporary" buffers open

From: Dmitry Gutov
Subject: xref and leaving "temporary" buffers open
Date: Sat, 25 Jul 2015 03:47:11 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0

Hi all,

The original implementation, by Helmut, didn't worry about that, and, for instance, used xref-buffer-location for the results of "find definitions" operation in the Elisp backend.

I was concerned about having opening lots of buffers, the user being surprised at seeing a querying operation make that change in their Emacs session. Then switch-to-buffer, as one example, might become more troublesome, for having too many options to choose from. Some Emacs features might slow down for having to deal with too many buffers (like auto-revert?). Anyway, a neat freak like yours truly might get annoyed. So I made the current implementations always clean up after themselves.

However, that causes a performance hit: opening a buffer takes time, especially when you need to syntax-propertize it (which is a requirement for xref--collect-match). So now even if I repeatedly search for the same thing, each search incurs the same performance penalty. Or, more practically, if a do a search and then press `r' to call `xref-query-replace', the latter has to reopen the killed buffers again. Which could be implemented, with certain amount of effort, in a deferred way so the user doesn't suffer too much, but even that would break if some xrefs from the same file appear separately in the list (and that might happen, for example, if etags--xref-find-definitions splits the results into groups by tag order).

Should we disregard this issue and say that xref doesn't have to close the buffers it needed to open during operation?

Another problem with that might be the contents getting out of date: what if the user doesn't have global-auto-revert-mode on? Then an xref search might get erroneous results from those buffers. Would it be allowed to call `revert-buffer' anywhere, as long as the buffer doesn't have unsaved changes?

Certain other programs might have a project and all its files loaded, but still display only a few of them as the ones the user is editing (probably using tabs). Should Emacs have a similar distinction, between loaded and open buffers?

reply via email to

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