[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 22:14:39 +0200
User-agent: mu4e 1.1.0; emacs 28.0.50

On 2021-07-27, at 15:49, Eli Zaretskii <> wrote:

>> From: Marcin Borkowski <>
>> Date: Tue, 27 Jul 2021 07:22:42 +0200
>> 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.
> Yes, it's a list that is created specifically for this function, and
> every time anew.  (Internally, overlays of a buffer aren't stored as a
> single list, so returning anything but a copy would be impossible.)

That's what I supposed - but I want to be sure I do not give bad advice
(relying on undocumented implementation details) - the reason for this
question was that I have code sorting a list of overlays in my book.

> The doc string kinda hints on that, since it talks about sorting the
> list, which would be unthinkable if it were the internal storage.

--8<---------------cut here---------------start------------->8---
Return a list of the overlays that overlap the region BEG ... END.
Overlap means that at least one character is contained within the overlay
and also contained within the specified region.
Empty overlays are included in the result if they are located at BEG,
between BEG and END, or at END provided END denotes the position at the
end of the buffer.
--8<---------------cut here---------------end--------------->8---

Where does it say anything about sorting?

Marcin Borkowski

reply via email to

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