From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: Is it ok to sort a list of overlays destructively? Date: Tue, 27 Jul 2021 11:40:30 +0200 Message-ID: <20210727094030.GB16064@tuxteam.de> References: <87h7ggcov1.fsf@mbork.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ZfOjI3PrQbgiZnxM" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22967"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Help Gnu Emacs mailing list To: Marcin Borkowski Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 27 11:41:24 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m8JaV-0005o8-TI for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 27 Jul 2021 11:41:23 +0200 Original-Received: from localhost ([::1]:38236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m8JaU-00078S-SH for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 27 Jul 2021 05:41:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m8JZq-000775-CK for help-gnu-emacs@gnu.org; Tue, 27 Jul 2021 05:40:42 -0400 Original-Received: from [5.199.139.25] (port=39357 helo=mail.tuxteam.de) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.90_1) (envelope-from ) id 1m8JZo-0000i6-N4 for help-gnu-emacs@gnu.org; Tue, 27 Jul 2021 05:40:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:Date; bh=2oBjhN2f8macLvnVVFVjyzyvSiAvVzLy6dGf5lCjTAY=; b=aspacmq7pOXImX5jGpEP5JOdin6m3YlRF8igKK57C6G4V0zzjSyu1Dnib5bZIQjjNWjIC7TOAuyhxJ2hcbaA1PQtJRHcyn0OGnBCkraV/163qa77851AZ2g2G9TWHh70QysQ5zyljRkkVD2q/at2cARsQlGd9KEV/iD9AZyn1Un/cwND2IstmD8vHXdnl9v8FlYUHmBq7jqoJxuzvcruAblkeK7Q+3CTx4EsF6Gfvtmcvt5RUtYp5CKPmrFwWzWm6fUYYHbUfXPa4SaXwY5pMlqNvqGyoOhD8/K5MkA5uxH8K37eDxbeRLFUbYeaAuJEntCQi9lQeX9dmWbWb8AlfQ==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1m8JZe-0004Uz-M7; Tue, 27 Jul 2021 11:40:30 +0200 Content-Disposition: inline In-Reply-To: <87h7ggcov1.fsf@mbork.pl> X-Host-Lookup-Failed: Reverse DNS lookup failed for 5.199.139.25 (failed) Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:132118 Archived-At: --ZfOjI3PrQbgiZnxM Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 27, 2021 at 07:22:42AM +0200, Marcin Borkowski wrote: > Hi all, >=20 > 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, >=20 > (eq (overlays-in (point-min) (point-max)) (overlays-in (point-min) (point= -max))) >=20 > 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? >=20 > So, is it a good practice to >=20 > (sort (overlays-in (point-min) (point-max)) > (lambda (o1 o2) > (< (overlay-start o1) (overlay-start o2)))) >=20 > ? 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 --ZfOjI3PrQbgiZnxM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAmD/1I4ACgkQBcgs9XrR2ka2rACdFIFLS1xgCR8dwe2v/OX0ijkf IOoAnRsG7jZzNNzS7MMZ+OX9pLtHKTof =uQvH -----END PGP SIGNATURE----- --ZfOjI3PrQbgiZnxM--