From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: xref and leaving "temporary" buffers open Date: Sat, 25 Jul 2015 08:47:05 -0500 Message-ID: <864mkscpt2.fsf@stephe-leake.org> References: <55B2DC8F.3050305@yandex.ru> <55B3489C.2070009@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1437832087 2455 80.91.229.3 (25 Jul 2015 13:48:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 25 Jul 2015 13:48:07 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 25 15:47:58 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZIznv-0003q5-8f for ged-emacs-devel@m.gmane.org; Sat, 25 Jul 2015 15:47:55 +0200 Original-Received: from localhost ([::1]:48153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIznu-0003hU-IS for ged-emacs-devel@m.gmane.org; Sat, 25 Jul 2015 09:47:54 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIznh-0003eg-Gp for emacs-devel@gnu.org; Sat, 25 Jul 2015 09:47:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIznc-0000Cm-Hw for emacs-devel@gnu.org; Sat, 25 Jul 2015 09:47:41 -0400 Original-Received: from gproxy4-pub.mail.unifiedlayer.com ([69.89.23.142]:34419) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1ZIznc-0000CT-AV for emacs-devel@gnu.org; Sat, 25 Jul 2015 09:47:36 -0400 Original-Received: (qmail 24825 invoked by uid 0); 25 Jul 2015 13:47:30 -0000 Original-Received: from unknown (HELO cmgw2) (10.0.90.83) by gproxy4.mail.unifiedlayer.com with SMTP; 25 Jul 2015 13:47:30 -0000 Original-Received: from host114.hostmonster.com ([74.220.207.114]) by cmgw2 with id wdnM1q00K2UdiVW01dnQRE; Sat, 25 Jul 2015 07:47:27 -0600 X-Authority-Analysis: v=2.1 cv=O9qq4nNW c=1 sm=1 tr=0 a=CQdxDb2CKd3SRg4I0/XZPQ==:117 a=CQdxDb2CKd3SRg4I0/XZPQ==:17 a=DsvgjBjRAAAA:8 a=f5113yIGAAAA:8 a=9i_RQKNPAAAA:8 a=y7kgw_RnJtkA:10 a=hEr_IkYJT6EA:10 a=x_XPkuGwIRMA:10 a=zOBTXjUuO1YA:10 a=DI9HINr1ugTKABzwlC8A:9 Original-Received: from [76.218.37.33] (port=58336 helo=TAKVER2) by host114.hostmonster.com with esmtpa (Exim 4.84) (envelope-from ) id 1ZIznO-00031y-Uc for emacs-devel@gnu.org; Sat, 25 Jul 2015 07:47:23 -0600 In-Reply-To: <55B3489C.2070009@gmx.at> (martin rudalics's message of "Sat, 25 Jul 2015 10:28:12 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt) X-Identified-User: {2442:host114.hostmonster.com:stephele:stephe-leake.org} {sentby:smtp auth 76.218.37.33 authed with stephen_leake@stephe-leake.org} X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 69.89.23.142 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:188064 Archived-At: martin rudalics writes: >> Should we disregard this issue and say that xref doesn't have to close >> the buffers it needed to open during operation? > > I'd try to implement some sort of heuristics, like adding a buffer to > some sort of a cache only after its file has been visited by an > application (like xref) at least N times and removing a buffer from that > cache if it has not been visited by an application (like xref) for at > least T minutes. Better for xref to cache the info it gathered from the buffer (assuming that's significantly smaller, and faster to access, than the buffer). >> 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? > > This should be made customizable. Yes. Also provide flush- or refresh-cache functions. >> 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? > > I think so. Each buffer should maintain a list of all the applications > that visited its file and all operations on buffer lists should be aware > of it. That makes sense. One use case would be "goto buffer in project", that completes only on buffers visiting files that belong to a project (in the xref "project" sense). The buffers could have a property "projects" that was a list of some project name/id/root directory. Another use case (that I've actually implemented differently) is deleting all buffers that were fetched by a front end to git as part of reviewing a commit (they display old versions of files). My current implementation relies on a list of such buffers maintained by the front end, but it would be better if there were some standard tag on the buffer. I don't like to close such buffers immediately after the first ediff session, because I often want to come back to them for some reason. Functions for deleting some buffers based on such buffer properties would also be useful. In the projects case, the buffer would not actually be deleted until there was only one project property left. -- -- Stephe