From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening large number of buffers Date: Thu, 14 Dec 2023 15:57:08 -0500 Message-ID: References: <878r919qfh.fsf@localhost> <87y1dzvvf0.fsf@localhost> <83plzas3pg.fsf@gnu.org> <87r0jqw8u9.fsf@localhost> <83jzpis08a.fsf@gnu.org> <87il52w744.fsf@localhost> <83fs06rz10.fsf@gnu.org> <87fs06w4ui.fsf@localhost> <83bkaurut9.fsf@gnu.org> <87o7esq319.fsf@localhost> <83bkasrb3f.fsf@gnu.org> <83wmtgpuyf.fsf@gnu.org> <83r0jopqk1.fsf@gnu.org> <83le9wpm60.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31050"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: dmitry@gutov.dev, yantar92@posteo.net, mattias.engdegard@gmail.com, 66117@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 14 21:58:23 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1rDsmk-0007rv-5s for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 Dec 2023 21:58:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rDsmT-0008LM-0q; Thu, 14 Dec 2023 15:58:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rDsmR-0008L0-3P for bug-gnu-emacs@gnu.org; Thu, 14 Dec 2023 15:58:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rDsmQ-0007dP-S2 for bug-gnu-emacs@gnu.org; Thu, 14 Dec 2023 15:58:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rDsmQ-00021E-5A for bug-gnu-emacs@gnu.org; Thu, 14 Dec 2023 15:58:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Dec 2023 20:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66117 X-GNU-PR-Package: emacs Original-Received: via spool by 66117-submit@debbugs.gnu.org id=B66117.17025874377696 (code B ref 66117); Thu, 14 Dec 2023 20:58:02 +0000 Original-Received: (at 66117) by debbugs.gnu.org; 14 Dec 2023 20:57:17 +0000 Original-Received: from localhost ([127.0.0.1]:51049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rDslh-000203-1r for submit@debbugs.gnu.org; Thu, 14 Dec 2023 15:57:17 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:22788) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rDslf-0001zo-Bd for 66117@debbugs.gnu.org; Thu, 14 Dec 2023 15:57:15 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 76D3880843; Thu, 14 Dec 2023 15:57:10 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1702587429; bh=NdFV2hWZt/g5szuO8HRrL/Z7Ain7qtpmHOsGWISpZ/g=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=MRrve8VG3QJ2r6k20o4zrBBqnszbfYX/PGUj5xpx7ay3FJx5K8YlGtnFuvx7+9ZO0 clm1dJ202lbqHMd/79ZuKn33WtvStbUOBV82t4ZvHJM6NBx8p7qc1TH9d6/Dj5z1uw XGCBvNX6iTUQCCGTjr8u7Zlwwot5sRqjtzzoFZe4SUc8zQSm8FLqSuPjVvySQdBeRP HgAMrvbc3nb1yWO8q9g4kGAXwAWDOJPc9IhyU5XJ4k2/6iI3XTM2q0OStRMKoWh/DV ZGTudaiue6OUvzYiON9tfVIpp8NcI5oBL//nVqgpaiVTu1sEE8GzlosY1quQUZs0S/ zknagz3148ueQ== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 2FD9D80801; Thu, 14 Dec 2023 15:57:09 -0500 (EST) Original-Received: from pastel (65-110-221-238.cpe.pppoe.ca [65.110.221.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id F1AC91203FE; Thu, 14 Dec 2023 15:57:08 -0500 (EST) In-Reply-To: <83le9wpm60.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 14 Dec 2023 22:24:39 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:276221 Archived-At: > Maybe. This discussion has enough confusion to confuse everyone. I've already been fooled more than once in this thread, indeed :-) >> Obviously the mere fact that the let-binding takes precedence means that >> we override the user's setting, but that's just an internal technical >> detail. To "step on the user's preference" we additionally need >> a situation where the user-visible result is not what the user wanted. > > Yes, and you are sure there aren't such cases, Oh, no, I'm definitely not sure, but since fixing this problem was cited as part of the motivation for the introduction of `case-fold-search-override`, I hope we have at least one or two concrete cases showing that it's a real problem. >> AFAICT most/all the times we do that, it's because we do a search that's >> "internal" to some operation and has thus no reason to obey the custom >> setting, which AFAICT is meant to affect interactive uses like Isearch >> (tho Isearch doesn't Isearch doesn't pay attention to >> `case-fold-search`, AFAICT, so really the user-visible effect of setting >> `case-fold-search` is quite limited). > This is wishful thinking not based by any data. Really? There are many let-bindings of `case-fold-search` in the tree, so it's hard to get a clear picture, but a random sampling of them suggests they mostly wrap searches where the regexps are not provided by the user but by the wrapped code (they're typically hard-coded). Admittedly, that doesn't mean that it would be wrong to obey the user's choice of `case-fold-search` there, but I think it clearly leans this way. >> >> IME the problem is rather the opposite: most calls to search functions >> >> don't explicitly let-bind `case-fold-search` and instead rely naively on >> >> the default value and are thus susceptible to bugs if/when someone sets >> >> the custom var (globally or buffer-locally). >> > I don't see that as a bug: the user said he/she wants the search to be >> > case-insensitive, so they should get what they asked for. >> But that's only true if the user runs a search command. > That's what I had in mind, and even said so. But I was talking about code which performs a search that's internal to the command rather than being the purpose of the command. Things like searches performed during indentation, searches performed to parse the output of processes, ... >> If the search is done within a non-search command (e.g. indentation), >> then the result is often not what the user wanted. > My point is that we use case-fold-search for two different purposes, > and so it is good to have 2 variables, one each for every purpose. We do use it for 2 different purposes, indeed. And I have seen this lead to bugs. But the bugs I recall went in the direction "user setting unexpectedly affecting internal searches" rather than "let-binding unexpected affecting user searches". I must admit that I can't point to concrete examples of the kind of bugs "I recall". But I don't know of examples of bugs caused by let-bindings overriding user settings either. So all in all, this seems like a weak justification for any change. Stefan