From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#59067: 29.0.50; Exexpected overlay order in `overlays-in' return value Date: Thu, 10 Nov 2022 16:56:15 -0500 Message-ID: References: <871qqgn44l.fsf@localhost> <838rko38g6.fsf@gnu.org> <878rkobm21.fsf@localhost> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36366"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 59067@debbugs.gnu.org, Ihor Radchenko , Eli Zaretskii To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 10 22:57:21 2022 Return-path: Envelope-to: geb-bug-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 1otFY0-0009E5-Do for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 10 Nov 2022 22:57:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otFXk-0004oM-8N; Thu, 10 Nov 2022 16:57:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1otFXi-0004jO-JU for bug-gnu-emacs@gnu.org; Thu, 10 Nov 2022 16:57:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1otFXi-0008DY-9u for bug-gnu-emacs@gnu.org; Thu, 10 Nov 2022 16:57:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1otFXi-00052N-2Y for bug-gnu-emacs@gnu.org; Thu, 10 Nov 2022 16:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 10 Nov 2022 21:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59067 X-GNU-PR-Package: emacs Original-Received: via spool by 59067-submit@debbugs.gnu.org id=B59067.166811739719329 (code B ref 59067); Thu, 10 Nov 2022 21:57:02 +0000 Original-Received: (at 59067) by debbugs.gnu.org; 10 Nov 2022 21:56:37 +0000 Original-Received: from localhost ([127.0.0.1]:44560 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otFXJ-00051h-2q for submit@debbugs.gnu.org; Thu, 10 Nov 2022 16:56:37 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:38713) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otFXD-00051Q-Tt for 59067@debbugs.gnu.org; Thu, 10 Nov 2022 16:56:35 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 3322644099E; Thu, 10 Nov 2022 16:56:26 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 5868544086A; Thu, 10 Nov 2022 16:56:17 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1668117377; bh=/2PS0kuQ/avbKHgB5cw0S7i0rxuVUTTay1HAji4fUCo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=RahmnvlhfO71/GkLrSjgnTzS6/lsyE0HL7fyVIGgz5DGKknyxUrNg/sgzCUEewTnQ aHqb7j7L18ZZglYb27S3rKGc5szuWD5UUBJoCVZkjrXjNZNrwraT4AV4rPS6NjEfAm CzEeUoXBlM2MI2oixWYMBNAQ/sM23vHetF3KqcZawYSxqECAsb068LjWvvseVnEr+V REAuwTYkOkRR42o7a9XTf4z9g+jQ8Ok4UhbuPHoR4Y9WehTVoJ69ewcgVr50D0M1s8 zA/MzseARxM80Hbxtfwfi/VWfz4cfmLjwmnJ6oUOV7+lfPmOmaLzo29Zu65SSBD3Cp wyTBF5nmpsr8g== Original-Received: from alfajor (unknown [45.44.229.252]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 10154120A4F; Thu, 10 Nov 2022 16:56:17 -0500 (EST) In-Reply-To: (Dmitry Gutov's message of "Thu, 10 Nov 2022 23:00:51 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:247553 Archived-At: >>>> Maybe Someone=E2=84=A2 should browse through the various calls to `ove= rlays-in` >>>> out there to try and see which orderings could be useful. >>> FWIW, mmm-mode uses overlay sorting based on the value of overlay-start >>> (first come overlays where this value is higher, so basically the more >>> deeply nested ones, if we imagine all overlays to be strictly nested, a= s is >>> the case with mmm-mode). >> AFAICT it sorts first based on priority and only for equal-priority >> overlays does it use the overlay's start. >> Is there any specific reason for this particular ordering? > > Historical, I suppose. mmm-mode doesn't set the 'priority' property these > days (the little snippet of code doing that is commented out). > > It kind of makes sense, but I don't have a better argument than that. I'm not asking for any kind of justification, but I'm wondering what would happen if you used a different sort order (i.e. the same but in reverse, or sorted by overlays's end, ...): would the rest of the code need to be adjusted? If so, in a trivial way? Or does some of the algorithm rely crucially on this particular ordering? In many cases, I have found that the ordering doesn't really matter, as long as it's deterministic. Stefan