Subject: Re: bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening large number of buffers

From: Eli Zaretskii <[email-masked]>
Date: Wed, 13 Dec 2023 17:22:42 +0200

> From: Ihor Radchenko <[email-masked]>
> Cc: [email-masked], [email-masked], [email-masked],
>  Mattias Engdegård <[email-masked]>
> Date: Wed, 13 Dec 2023 14:32:21 +0000
> 
> > Btw, are you aware that many case-insensitive operations in Emacs
> > depend also on the case table in effect, which can also be
> > buffer-local?  So case-insensitive operations in Lisp can be
> > unexpectedly affected by stuff like the current buffer.  One more
> > reason to use them as little as possible.
> 
> ... and syntax-table can be set in text properties; so not just affected
> by current buffer - also by position in buffer.

If you search the buffer text, then having syntax-table on that text
is less surprising: after all, it only affects the text which has this
property.

But buffer-local case-table is much more subtle: it is in effect even
if you match strings, not portions of buffer text, and only because
some buffer _happens_ to be the current buffer when, say, string-match
is called.

> In the past, me and Mattias Engdegård even discussed a possibility to
> incorporate case-fold-search flag into regexps directly
> (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63225#74)
> That way, things would be less affected by the buffer-locals.

Indeed.