Subject: Re: bug#29889: 27.0.50; Slow visual selection

From: Po Lu <[email-masked]>
Date: Fri, 20 May 2022 16:39:54 +0800

Po Lu <[email-masked]> writes:

> I didn't yet read the rest of the bug report, but AFAIK we already have
> a way to set a selection to a pair of positions in a buffer.  Requestors
> get the contents of the buffer between those two positions, but no
> string is consed until a program actually asks for the contents of the
> selection.
>
> We could have a new value of `select-active-regions' that tells Emacs to
> set the primary selections to buffer positions if the active region is
> not temporary, thereby avoiding the unreasonably high amount of string
> consing.
>
> The only problem is that this feature is only implemented on X and
> Haiku, and not consing a string every time the selection is set is
> impossible outside X.

We could also set the selection to two buffer positions or avoid setting
the primary selection if the region is more than N characters in length.