From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Speed up project-kill-buffers Date: Mon, 17 May 2021 00:58:06 +0300 Message-ID: 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27285"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 Cc: Philip Kaludercic , Stefan Monnier , emacs-devel@gnu.org To: Stephen Leake Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 16 23:58:56 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 1liOml-0006qC-Bf for ged-emacs-devel@m.gmane-mx.org; Sun, 16 May 2021 23:58:55 +0200 Original-Received: from localhost ([::1]:52670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1liOmj-0008NM-Gu for ged-emacs-devel@m.gmane-mx.org; Sun, 16 May 2021 17:58:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1liOm5-0007hg-4q for emacs-devel@gnu.org; Sun, 16 May 2021 17:58:13 -0400 Original-Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:43959) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1liOm3-00044t-6t for emacs-devel@gnu.org; Sun, 16 May 2021 17:58:12 -0400 Original-Received: by mail-wr1-x433.google.com with SMTP id p7so684240wru.10 for ; Sun, 16 May 2021 14:58:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=uQruK8hT2Gez9oJk3btwqNjw4JnxU7jTcPKaf4lwntA=; b=cHi7w+gBjTEnUY8Yzq4iHHNVC81+TIjbe0ZQxA/1Kik5tp54RBraP0kJvaNpdkoo+o unBacBjY6789ZapOEMefnGuatvDQ41PtJwyJMXeKdJ0vTyj+YmBYpUgQlh/sQCLMfkgE VVZMr16rDG/iJFqpKjlSaAbHrqi3Ln9M9+gJ7jSjRiPWjV621g88Ahukns9Q1vogyxZc 1WoSdGfRPRcqH/8pseZO0lINnyNDKmnuBMilAPft6ZwzNH3knoWBJ85SVKVSuVrkL6sn /8PJHesdsEHO5EedcijaER5ozmK/FgxJKJPCerlUzPco3IQHN1QiSw6Ras8lAdnvAjB9 8tfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=uQruK8hT2Gez9oJk3btwqNjw4JnxU7jTcPKaf4lwntA=; b=srLV1ZMqPSmKrk+/YRAlV8vNsC1t8elOKPX6v4g/GLWxBYDzzYs++IbE//frBqMWVH pEJjP0TgUofBXAtUHy5F6xm/nnhdCwdN/aGBKZzFQJti5OG9nLT4x6Em4oI2n9Dw5Tjq 8AYKDV00jw6hJ0MKCkSKeWsV2NxgQL5Xj8wrin9k8ksDGZd4URviDaL1qN72bu522S+l kfCW+4I1tro0hefRqzcBEMxE0YIET+t/8tYFQqmxu54HQjRBRpFtDVZvB7vdW+/W51eO bqv2lNEZYF5bTVkgKxCx3H0UUDfcRlKTxvSfALcfPhAdvXsd54yQOagucC49KU1q6g/K LOxQ== X-Gm-Message-State: AOAM530jwfQWMA6qQ/3BPd6Ck4ZCJenBdaVUiDnQnSSQloUh/P1Oj6tZ md7ZvIy5JKXl1HgEOY4vqQ3zC8zAQPI= X-Google-Smtp-Source: ABdhPJycX7ZhyEhu+ocy0BL/yS06w/0GGN4ZwWxJ/WDtJ92uX/J2Lzq0QT554rIfqPuHxmcxO0BA8g== X-Received: by 2002:a05:6000:504:: with SMTP id a4mr72139546wrf.51.1621202288887; Sun, 16 May 2021 14:58:08 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id z6sm4503095wml.29.2021.05.16.14.58.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 16 May 2021 14:58:08 -0700 (PDT) In-Reply-To: <86im3i76xa.fsf@stephe-leake.org> Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=raaahh@gmail.com; helo=mail-wr1-x433.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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:269383 Archived-At: On 16.05.2021 23:36, Stephen Leake wrote: > Which means you need to provide an option for the times when we want the > other behavior: C-u kills root and external-roots, plain kills root only. I wouldn't mind adding an option, but that presents a difficulty. At the moment, we call `project-current` in each buffer and compare the returned value to the "current" project instance. That wouldn't work for external roots no matter what option we add because a given file inside "external root" can belong (in an "extended" sense) to several projects at once, so there's no logical way to obtain the project instance we're looking for based on such external file. Right? A generic like project-contains? I previously mentioned would have a problem that every project backend's implementation would have to obey such an option, which creates new possibility for bugs and diverging behaviors. If the current project-kill-buffers doesn't work for you (please check; IIRC your backend's peculiar behavior might have an upside in this case), what we could more easily do is create an option like 'project-list-buffers-function'. The default would delegate to project-current. The alternative could indeed use file-in-directory-p (or a string comparison to similar effect) as discussed in this thread, providing a different inclusion semantics and improved performance, and the third alternative value could enable looking in external roots as well.