[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is it ok to sort a list of overlays destructively?
From: |
tomas |
Subject: |
Re: Is it ok to sort a list of overlays destructively? |
Date: |
Tue, 27 Jul 2021 11:40:30 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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.
But perhaps I'm too timid :)
Cheers
- t
signature.asc
Description: Digital signature
- Is it ok to sort a list of overlays destructively?, Marcin Borkowski, 2021/07/27
- Re: Is it ok to sort a list of overlays destructively?,
tomas <=
- Re: Is it ok to sort a list of overlays destructively?, Eli Zaretskii, 2021/07/27
- Re: Is it ok to sort a list of overlays destructively?, Marcin Borkowski, 2021/07/27
- Re: Is it ok to sort a list of overlays destructively?, Eli Zaretskii, 2021/07/27
- Re: Is it ok to sort a list of overlays destructively?, Marcin Borkowski, 2021/07/28
- Re: Is it ok to sort a list of overlays destructively?, Eli Zaretskii, 2021/07/28
- Re: Is it ok to sort a list of overlays destructively?, John Yates, 2021/07/29
- Re: Is it ok to sort a list of overlays destructively?, Eli Zaretskii, 2021/07/29
- Re: Is it ok to sort a list of overlays destructively?, 2QdxY4RzWzUUiLuE, 2021/07/29
- Re: Is it ok to sort a list of overlays destructively?, Eli Zaretskii, 2021/07/29