unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#60058: 29.0.60; overlay-lists does not conform to its docstring
@ 2022-12-14  5:22 Kai Ma
  2022-12-14 12:23 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Kai Ma @ 2022-12-14  5:22 UTC (permalink / raw)
  To: 60058

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-14 18:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-14  5:22 bug#60058: 29.0.60; overlay-lists does not conform to its docstring Kai Ma
2022-12-14 12:23 ` Eli Zaretskii
2022-12-14 14:21   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-14 18:19     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).