From: <tomas@tuxteam.de>
To: Marcin Borkowski <mbork@mbork.pl>
Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: Re: Is it ok to sort a list of overlays destructively?
Date: Tue, 27 Jul 2021 11:40:30 +0200 [thread overview]
Message-ID: <20210727094030.GB16064@tuxteam.de> (raw)
In-Reply-To: <87h7ggcov1.fsf@mbork.pl>
[-- Attachment #1: Type: text/plain, Size: 909 bytes --]
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
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2021-07-27 9:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-27 5:22 Is it ok to sort a list of overlays destructively? Marcin Borkowski
2021-07-27 9:40 ` tomas [this message]
2021-07-27 10:07 ` Marcin Borkowski
2021-07-27 13:49 ` Eli Zaretskii
2021-07-27 20:14 ` Marcin Borkowski
2021-07-28 2:25 ` Eli Zaretskii
2021-07-28 6:06 ` Marcin Borkowski
2021-07-28 11:44 ` Eli Zaretskii
2021-07-29 11:34 ` John Yates
2021-07-29 12:33 ` Eli Zaretskii
2021-07-29 15:11 ` 2QdxY4RzWzUUiLuE
2021-07-29 15:30 ` Eli Zaretskii
2021-07-29 16:20 ` 2QdxY4RzWzUUiLuE
2021-07-29 16:53 ` Eli Zaretskii
2021-07-30 19:27 ` Marcin Borkowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210727094030.GB16064@tuxteam.de \
--to=tomas@tuxteam.de \
--cc=help-gnu-emacs@gnu.org \
--cc=mbork@mbork.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.