From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60058: 29.0.60; overlay-lists does not conform to its docstring Date: Wed, 14 Dec 2022 14:23:31 +0200 Message-ID: <83a63qnph8.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34536"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60058@debbugs.gnu.org To: Kai Ma , Lars Ingebrigtsen , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 14 13:24:25 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 1p5QoC-0008lC-J6 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Dec 2022 13:24:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5Qo1-0003sD-LY; Wed, 14 Dec 2022 07:24:14 -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 1p5Qnq-0003r9-NX for bug-gnu-emacs@gnu.org; Wed, 14 Dec 2022 07:24:03 -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 1p5Qnq-0004WC-FY for bug-gnu-emacs@gnu.org; Wed, 14 Dec 2022 07:24:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p5Qnp-0005oD-Qb for bug-gnu-emacs@gnu.org; Wed, 14 Dec 2022 07:24:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Dec 2022 12:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60058 X-GNU-PR-Package: emacs Original-Received: via spool by 60058-submit@debbugs.gnu.org id=B60058.167102062622316 (code B ref 60058); Wed, 14 Dec 2022 12:24:01 +0000 Original-Received: (at 60058) by debbugs.gnu.org; 14 Dec 2022 12:23:46 +0000 Original-Received: from localhost ([127.0.0.1]:38830 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5QnZ-0005ns-L7 for submit@debbugs.gnu.org; Wed, 14 Dec 2022 07:23:45 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33120) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5QnW-0005ni-Ip for 60058@debbugs.gnu.org; Wed, 14 Dec 2022 07:23:43 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5QnP-00044D-WF; Wed, 14 Dec 2022 07:23:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Et8JfM/8y1cUoZRbhddpUbChOtZBhMD6pfJgNoKVgR4=; b=mCnGqJpxo+S2 RjbkF3u102ntoMBMiHBNQ09wHZ1sBXhkuJlIAx809bVYZzE2bXmFnSZcNomITOGoWTS8fyvGAqXpg KQW6Dg4g3YDjnjVKI7KHxAQDeknpfAzBusJZTGHdFrsht+/QsgMEioTaPT+i+a0m3M6O1MVf13MsL dBefR86+vlMpyzACWE6hMVXFuvV37AX/MlQbIGP/3hHmRdMDXeutibX6zEZRPtO5SdHZ4mH2QoAmJ u11EPupz7yLXGFg8xJUbR5ulR0egrponlEdYzFFfSPx3gvXRpngVcwixK6igU0JAT8/ryuN3Mlyj7 nPH8tMTxINi9Rlw2WQCK0w==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5QnO-0006uT-Ib; Wed, 14 Dec 2022 07:23:34 -0500 In-Reply-To: (message from Kai Ma on Wed, 14 Dec 2022 13:22:07 +0800) 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:250932 Archived-At: > From: Kai Ma > Date: Wed, 14 Dec 2022 13:22:07 +0800 > > The docstring of overlay-lists states that the return value is a cons > pair, and the CDR is not always nil. However, the code does not do what > it claims to do. > > DEFUN ("overlay-lists", Foverlay_lists, Soverlay_lists, 0, 0, 0, > doc: /* Return a pair of lists giving all the overlays of the current buffer. > The car has all the overlays before the overlay center; > the cdr has all the overlays after the overlay center. > Recentering overlays moves overlays between these lists. > The lists you get are copies, so that changing them has no effect. > However, the overlays you get are the real objects that the buffer uses. */) > (void) > { > Lisp_Object overlays = Qnil; > struct itree_node *node; > > ITREE_FOREACH (node, current_buffer->overlays, BEG, Z, DESCENDING) > overlays = Fcons (node->data, overlays); > > return Fcons (overlays, Qnil); > } > > This change in behavior has led to at least one breakage in the wild: > symbol-overlay cannot count overlays correctly. > > I think there is a problem either in the code or in the docstring. The problem is not in overlay-lists, IMO, the problem (if there is one) is in overlay-recenter: it is a no-op in Emacs 29 and later. I think we have two alternatives: . reimplement overlay-recenter for the new overlay representation . document that overlay-recenter is a no-op, as an incompatible Lisp change, and recommend that Lisp program simply stop relying on its effect in Emacs >= 29: after all, the sole purpose of that function was to speed up overlay access, and now this is not needed I tend to do the latter. Lars, Stefan, any ideas or comments?