Subject: bug#60058: closed (Re: bug#60058: 29.0.60; overlay-lists does not conform to its docstring)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 14 Dec 2022 18:20:01 +0000

Your bug report

#60058: 29.0.60; overlay-lists does not conform to its docstring

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
60058: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60058
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#60058: 29.0.60; overlay-lists does not conform to its docstring
From: Eli Zaretskii <[email-masked]>
To: Stefan Monnier <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked]
Date: Wed, 14 Dec 2022 20:19:39 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Stefan Monnier <[email-masked]>
> Cc: Kai Ma <[email-masked]>,  Lars Ingebrigtsen <[email-masked]>,
>   [email-masked]
> Date: Wed, 14 Dec 2022 09:21:44 -0500
> 
> > 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.
> 
> The use of `overlay-recenter` together with `overlay-lists` took me
> by surprise.  So yes, I think we should document that `overlay-recenter`
> is a no-op.  We should also mark it obsolete.

I didn't mark it obsolete yet.  Having Emacs 29.1 annoy programs that
call a function that is a no-op, and adding that so close to the
release, sounds like not the best idea.  Maybe we should consider
obsoleting it in Emacs 30.

Otherwise, I did update the documentation to be consistent with the
new implementation of the overlays (see also bug#59996), and I'm
therefore closing this bug report.

Subject: 29.0.60; overlay-lists does not conform to its docstring
From: Kai Ma <[email-masked]>
To: [email-masked]
Date: Wed, 14 Dec 2022 13:22:07 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

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.

	Kai