Subject: Re: bug#35536: 27.0.50; Expose buffer's marker list to Elisp

From: "Basil L. Contovounesios" <[email-masked]>
Date: Fri, 03 May 2019 18:22:39 +0100

Drew Adams <[email-masked]> writes:

>> When asked for a list of markers between BEG and END, it makes sense to
>> me to return a list which ascends from BEG to END.
>                             ^^^^^^^^^^^^^^^^^^^^^^^
> IOW, in buffer-position order.

Yes.

>> If it really matters, we could either return the
>> order of BUF_MARKERS unchanged,
>
> Unchanged from what?

>From the order returned by BUF_MARKERS, i.e. the internal chain of
markers pointing to the current buffer.  This order presumably reflects,
to an extent, the order in which markers were created/chained, but I'm
not sure about this.

>> or accept an additional argument which tells the
>> function how to sort.
>
> Have not really been following this thread, and
> not weighing in on whether such a function is
> needed or whether users need access to markers
> created by C.
>
> But as for the order of such a list: It's trivial
> for users (any Lisp code) to sort by buffer position
> or anything else, so why would the default order
> be by buffer position?

That is the order I would intuitively expect in any enumeration of a
partially ordered set of buffer artifacts in a given region, unless
otherwise stated.

What other order would make sense when talking about markers within a
given region?

> What's _not_ available to users or Lisp code, I
> think, is the order of marker creation or even the
> order of last setting.  I'd think that
> marker-creation order (either direction) would be
> a better default sort order for this, no?

Perhaps when enumerating markers pointing at a single position, yes.
But I think that ordering would make less sense when talking about
markers within a given region.  Assuming something like marker-list is
deemed a useful addition (which is not yet clear), perhaps there should
be two separate functions akin to overlays-in and overlays-at, with
different sorting options and/or default policies.

Thanks,

-- 
Basil