unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: eliz@gnu.org, rms@gnu.org, emacs-devel@gnu.org
Subject: RE: Overlay insertion types, markers, etc.
Date: Sun, 17 Nov 2019 09:35:47 -0800 (PST)	[thread overview]
Message-ID: <abcabc77-6b70-4c13-8761-ea15f5db62eb@default> (raw)
In-Reply-To: <jwvblta8pug.fsf-monnier+emacs@gnu.org>

> > 4. Can you retrieve the markers that are "used by"
> >    an overlay, i.e., as markers?
> 
> No, you can't, and you shouldn't be able to: it's
> an implementation detail, that may change in the
> future (IIUC the `noverlays` branch indeed makes
> this change as part of a rewrite which tries to
> eliminate some algorithmic complexity problems in
> the overlay code).

OK.  The other questions I asked were about using
the markers passed to `make-overlay' to specify the
_defaults_ for the overlay: insertion types and
buffer.  That is, the values to use for those if
the optional args to specify them aren't provided.

Those other questions were not about the markers in
the overlay itself - they were only about obtaining
default info when creating an overlay and passing
it markers instead of numbers.

This question (#4) was different.  It was about
Lisp access to the markers used in the overlay
itself.  About which nothing is said, BTW.  But Eli
has confirmed that they are indeed markers.

"Marker" in the Elisp doc (other than here) means
an object accessible from Lisp.  It's confusing
to talk, in passing - with no description or
explanation, of "markers" that are used by an
overlay (i.e., as part of it), but that are
(it turns out) not markers in the usual sense,
because they're not accessible to Lisp.

It confused me anyway.  All the more so because
the doc doesn't actually say they're only internal,
not accessible.

Hence this question (#4), to find out if they are
in fact somehow accessible.

> Also it would introduce all kinds of extra work:
> - when an overlay is moved, the redisplay code is
>   told about it, whereas no redisplay is normally
>   caused by moving a marker, so we'd need to figure
>   out what to do when an "overlay-owned" marker is
>   moved.

I'm not proposing anything.  But I'm guessing that
that point is incorrect in one sense (one direction).

If the overlay does, as the doc and Eli say, use
markers, then when the overlay is moved those
markers are presumably already updated accordingly.

But there's also the reverse, which you bring up:
moving the markers.  You segue to moving (e.g. by
Lisp) one or both of the overlay markers.

> - the user could now move the start-marker of an
>   overlay to another buffer than the end-marker
> - the user could now move the end-marker of an
>   overlay before the start-marker (this can already
>   happen but only in very specific cases, so we'd
>   have to handle it in more cases).

Those are cases of not only examining the markers
from Lisp but changing them.

There is already a (mysterious, IMO, since the
markers are currently internal) warning in the
Elisp manual _not to do_ that:

  "Do not try modifying the markers in the
   overlay by hand..."

(Eli has said that that warning must be to not
try that using C code.  Why such a warning would
be in the Elisp manual is not clear to me.)

But suppose the markers were modifiable from Lisp,
and suppose someone ignored the warning.  The
result could (by design) simply be to delete the
overlay.  IOW, if an overlay for any reason has
markers that are nonsensical (for an overlay) then
treat it as deleted (no buffer).  One possibility.

Again, I didn't propose providing Lisp access.
I was asking why we tell users that an overlay
has markers, instead of, for example, just saying
that it has a start, an end, and a buffer?  Why
talk about the "markers" of an overlay at all?

Especially since they apparently are not markers
in the usual sense (Lisp objects).

We don't use markers passed as `make-overlay'
args for anything but initializing the start and
end positions (presumably swapping them, if
passed in the wrong order numerically).

What's the point of documenting that an overlay
has markers?  And not saying clearly that they're
only internal - not normal markers (i.e.,
Lisp-accessible)?  And warning users not to
modify them - which they can't do anyway using
Lisp.

It's the doc that led me to ask these questions.

I haven't proposed any changes to the behavior -
or even to the doc.  But given the answers to my
questions so far, it seems to me (assuming that
no behavior changes are in order or desired),
that the doc should maybe be changed a bit.  No?

---

BTW, you mention "the `noverlays` branch indeed
makes this change as part of a rewrite which tries
to eliminate some algorithmic complexity problems
in the overlay code."

What's that about?  Is there a plan to remove
overlays?  It would be good to know this, so we
(e.g. 3rd-party code) don't waste time developing
things that depend more on overlays.



  reply	other threads:[~2019-11-17 17:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<<20c74b83-6272-44e9-b4ac-829fd4cd0143@default>
     [not found] ` <<<83lfsh2zvf.fsf@gnu.org>
     [not found]   ` <<a2de3d64-2fb6-41e4-aabe-0be2ec404478@default>
     [not found]     ` <<83v9rl12t1.fsf@gnu.org>
2019-11-15 17:32       ` Overlay insertion types, markers, etc Drew Adams
2019-11-17  2:15         ` Richard Stallman
2019-11-17  2:26           ` Drew Adams
2019-11-17 15:55             ` Stefan Monnier
2019-11-17 17:35               ` Drew Adams [this message]
2019-11-20 16:17             ` Richard Stallman
2019-11-20 17:33               ` Eli Zaretskii
2019-11-20 17:38               ` Drew Adams
     [not found] <<20c74b83-6272-44e9-b4ac-829fd4cd0143@default>
     [not found] ` <<83lfsh2zvf.fsf@gnu.org>
2019-11-15 16:54   ` Drew Adams
2019-11-15 17:12     ` Eli Zaretskii
2019-11-12  0:09 Drew Adams
2019-11-13 15:36 ` Drew Adams
2019-11-15 10:33 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=abcabc77-6b70-4c13-8761-ea15f5db62eb@default \
    --to=drew.adams@oracle.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).