From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: xref and leaving "temporary" buffers open Date: Sat, 25 Jul 2015 03:47:11 +0300 Message-ID: <55B2DC8F.3050305@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1437785261 8186 80.91.229.3 (25 Jul 2015 00:47:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 25 Jul 2015 00:47:41 +0000 (UTC) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 25 02:47:26 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 1ZIncb-0008F6-BN for ged-emacs-devel@m.gmane.org; Sat, 25 Jul 2015 02:47:25 +0200 Original-Received: from localhost ([::1]:46933 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZInca-0005kT-Dc for ged-emacs-devel@m.gmane.org; Fri, 24 Jul 2015 20:47:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38817) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIncV-0005kA-QP for emacs-devel@gnu.org; Fri, 24 Jul 2015 20:47:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIncR-000722-Lq for emacs-devel@gnu.org; Fri, 24 Jul 2015 20:47:19 -0400 Original-Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]:37689) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIncR-00071i-DR for emacs-devel@gnu.org; Fri, 24 Jul 2015 20:47:15 -0400 Original-Received: by wibud3 with SMTP id ud3so51428206wib.0 for ; Fri, 24 Jul 2015 17:47:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-type:content-transfer-encoding; bh=VxUJWuf+WJgOmQ9UGlAaguSDAnhHpv+YhxApfrMfwgA=; b=jfmwq6qSFIZ9sG0Qlp+AIVEAoLmAfutsKcVelhnWA0kx8uZadUwiYUsTiUWx7/F4A9 4lAbGKLnqKyoaMz66JT3r9cQxTorLmjGHTnN2shU9o2K/qb7fUIfpzJ9zC7Pog5xsBhV lxqwoFtLvHcstuNYa9TE+S/kOHtNhF0xAiMqZIOtN48rCvU3WKjiSJK42b6yLCi00MBs Q9fbsv5sbs+a95EvxkGvuCX193wSq2mvabB73cr+l6WxHP3L4nRpBHVxT/xsF5HbsLWZ zRa/Czzg2cNHp/2j9F0WNmVLXpXiLJj8rn1tJt6Rb/UkjHxvBJzWJhIAWgD9uqw0PY4n BEUA== X-Received: by 10.180.74.132 with SMTP id t4mr1852416wiv.55.1437785234509; Fri, 24 Jul 2015 17:47:14 -0700 (PDT) Original-Received: from [192.168.1.2] ([185.105.175.24]) by smtp.googlemail.com with ESMTPSA id qq1sm15150625wjc.0.2015.07.24.17.47.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2015 17:47:13 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::232 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:188053 Archived-At: 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?