From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Speed up project-kill-buffers Date: Sun, 30 May 2021 10:51:50 -0700 Message-ID: <868s3whzyh.fsf@stephe-leake.org> References: <87mttcgnke.fsf@posteo.net> <871raoezl0.fsf@posteo.net> <86r1ihig9p.fsf@stephe-leake.org> <25bc7f1c-92e5-6b13-a6a4-d48b64b32ad3@yandex.ru> <86im3i76xa.fsf@stephe-leake.org> <86pmxmz45m.fsf@stephe-leake.org> <44b0b57f-27fd-d0b6-f350-5745375ff2a4@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26108"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (windows-nt) Cc: Philip Kaludercic , Stefan Monnier , emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 30 19:52:42 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lnPcA-0006dz-Gt for ged-emacs-devel@m.gmane-mx.org; Sun, 30 May 2021 19:52:42 +0200 Original-Received: from localhost ([::1]:52618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnPc9-0003uj-3H for ged-emacs-devel@m.gmane-mx.org; Sun, 30 May 2021 13:52:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnPbV-0003DP-7E for emacs-devel@gnu.org; Sun, 30 May 2021 13:52:01 -0400 Original-Received: from gateway36.websitewelcome.com ([192.185.187.5]:20283) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnPbR-0007qp-QG for emacs-devel@gnu.org; Sun, 30 May 2021 13:52:00 -0400 Original-Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 6DC3E400CFD56 for ; Sun, 30 May 2021 12:51:53 -0500 (CDT) Original-Received: from host2007.hostmonster.com ([67.20.76.71]) by cmsmtp with SMTP id nPbNltMrf8ElSnPbNlHKE3; Sun, 30 May 2021 12:51:53 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stephe-leake.org; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=m70HGZj+7CsguU29WeXdLYrdqzrtLbqTjSafO2Uhccw=; b=gTD4Y2dQLaezEcyb3fOq1WQEiv jkoTEczaEVRol+AdFEeyf3EpXuZIomqkjh8Gdc+/nxklu0L1o/s3J31TmabXKa6Ws0JZLFRkQmu48 BMADTo8RbCMj05aRIkQyNAtGB/CQQ1GhneUaInKHxieY081P/n6L2p2DL53qgAmQTZZLvUtAhtP/s E4tF3mbOISmxdfQAIvZWZZSp7ZHL2cOiwW6doY/Q758JXnYwWAUxuAf6uCTNcAbh3xQDZrHRBivJX G9LSUqwk0aBe+UpmhqHHhzK618Is9nP5V3T5uWR/ko/JZmtOlwYcWnZoI5YVo8ZnLBcVK8FWjT3/I nBUyTzgA==; Original-Received: from [76.77.182.20] (port=63557 helo=Takver4) by host2007.hostmonster.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lnPbM-003Y8u-NP; Sun, 30 May 2021 11:51:52 -0600 In-Reply-To: <44b0b57f-27fd-d0b6-f350-5745375ff2a4@yandex.ru> (Dmitry Gutov's message of "Tue, 25 May 2021 04:24:57 +0300") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2007.hostmonster.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stephe-leake.org X-BWhitelist: no X-Source-IP: 76.77.182.20 X-Source-L: No X-Exim-ID: 1lnPbM-003Y8u-NP X-Source-Sender: (Takver4) [76.77.182.20]:63557 X-Source-Auth: stephen_leake@stephe-leake.org X-Email-Count: 6 X-Source-Cap: c3RlcGhlbGU7c3RlcGhlbGU7aG9zdDIwMDcuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes Received-SPF: neutral client-ip=192.185.187.5; envelope-from=stephen_leake@stephe-leake.org; helo=gateway36.websitewelcome.com X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_NEUTRAL=0.779 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:270140 Archived-At: Dmitry Gutov writes: >>> A generic like project-contains? >> That's one option, with the current predicate in >> project--buffer-list as >> the default implementation; then I could override that to check >> project-files, or all roots, or something. As long as it passes C-u to >> the backend, my function could also use that to decide about dependent >> libraries. > > I'm fairly sure you don't want to close the buffers visiting the > dependencies. Sometimes I do; I'm done working on ada-mode, and I transition to working on my music database, closing all ada-mode related files. Other times I don't; I found a bug in ada-mode, so I move to the wisitoken library to run tests there, closing only the higher-level ada-mode files. The point is that it is up to the user, to decide on a case by case basis. > Or if we do, that would be a globally acting modifier, and that piece > of logic which we would add to project-kill-buffers would just see > whether the buffer's default-directory is inside any of the "external > roots", as defined by the backend. Would that work for you? I don't follow. What is the UI? How does the information given by the user get passed to the backend? Only the backend can interpret "dependencies". And no, not all project files can be distinguished by directory; I have files in the same directory that are managed by different projects (Ada and elisp). >> It might be better to make the predicate more specific; >> project-delete-this-buffer-p. That way eglot won't try to abuse >> project-contains to pick a server :). Or maybe my delete buffer case >> and eglot's "choose the right server" case really are the same? > > I'd rather we try to be more strict with semantics, if possible, and > 'project-contains?' would only return t for buffers "inside" the > project, not stuff that's outside but related to it (like external > libraries, system includes, etc, which is what I'd like "external > roots" to be targeted at). Then you need an "include-external-roots" arg to project-contains, since sometimes that's what the user wants. >> I think another generic project-name, or possbly project-prompt, >> would >> be good here. The default could be project-root. > > We can add that, but please file that as a separate bug report. Done; 48747 >> There should also be a custom boolean to turn off the prompt; it's >> helpful the first few times, then it's just annoying. Currently C-u is >> 'no-confirm'; I hope that will change to 'no-dependencies'. > > It *might* change to "include dependencies", since currently it's not > supposed to include them. > > If you want this change to happen, could you outline the cases when > you would and would not use this capability? Personally, I'd probably > never kill those buffers. I gave examples above. In general, if I'm switching to a project that shares some files with the current one, I don't want to delete those buffers. So the correct semantics would be "switching from project A to project B; close all non-shared buffers". -- -- Stephe