[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is it ok to sort a list of overlays destructively?

From: Marcin Borkowski
Subject: Re: Is it ok to sort a list of overlays destructively?
Date: Tue, 27 Jul 2021 12:07:19 +0200
User-agent: mu4e 1.1.0; emacs 28.0.50

On 2021-07-27, at 11:40, wrote:

> On Tue, Jul 27, 2021 at 07:22:42AM +0200, Marcin Borkowski wrote:
>> Hi all,
>> I need to sort the list of overlays returned by `overlays-in'.  The docs
>> for that function do not says explicitly that it creates a new list
>> every time, although a cursory glance at its source says that it
>> apparently does.  (Also,
>> (eq (overlays-in (point-min) (point-max)) (overlays-in (point-min) 
>> (point-max)))
>> is nil also when there are overlays in the buffer, so it seems to be the
>> case.)  OTOH, if creating a new list every time isn't in the docs, one
>> shouldn't rely on it, no?
>> So, is it a good practice to
>> (sort (overlays-in (point-min) (point-max))
>>       (lambda (o1 o2)
>>      (< (overlay-start o1) (overlay-start o2))))
>> ?
> Heh. Good question. I wouldn't, unless the docs said explicitly that it
> makes a fresh list.

Precisely my attitude, but I was curious if it's a good one or only my
OCTD kicking in.


Marcin Borkowski

reply via email to

[Prev in Thread] Current Thread [Next in Thread]