emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Overlay insertion types, markers, etc.


From: Eli Zaretskii
Subject: Re: Overlay insertion types, markers, etc.
Date: Fri, 15 Nov 2019 12:33:08 +0200

> Date: Tue, 12 Nov 2019 00:09:18 +0000 (UTC)
> From: Drew Adams <address@hidden>
> 
> Why, if you pass markers, isn't the default to use
> the insertion types of those markers?

Because the markers passed to make-overlay are treated only as
representing buffer positions, similarly to other functions, like
goto-char.

> 2. `make-overlay' seems to be the only way to specify
> the insertion types for an overlay.  Is that right,
> or did I miss something?

That's right.

> Why isn't there (or is there?) a simple way to
> change the "marker insertion types" of an existing
> overlay?

Because it's easy to do that by hand?

> Suppose you want to copy an existing overlay and
> then change some things in the copy.  You can't
> change the insertion types for it, right?
> 
> I guess you need to use `make-overlay', specifying
> insertion types, and then explicitly copy everything
> else from the first overlay.  Is that right?

Yes.

> 3. Similarly, the default BUFFER for `make-overlay'
> is the current buffer, even if you pass markers.
> 
> Third question (similar to the first):
> 
> Why, if you pass markers to `make-overlay', and
> you don't pass arg BUFFER, isn't the default to
> use the buffer of those markers?

Because that just complicates the implementation with no real gain:
what to do if the markers point to different buffers, or if their
buffers don't exist, or the position information doesn't fit, etc.?

> 4. (Repeating) "An overlay uses markers to record
> its beginning and end."
> 
> It seems that an overlay "uses markers" but those
> aren't the markers you passed to `make-overlay'.
> Is that right?

Yes.

> Can you retrieve the markers that are "used by"
> an overlay, i.e., as markers?

No.  We don't want to give Lisp access to those markers, as that could
mean giving to long a rope to Lisp programs to hang themselves.

> "This is the only valid way to change the endpoints
> of an overlay.  Do not try modifying the markers in
>                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> the overlay by hand, as that fails to update other
> vital data structures and can cause some overlays
> to be lost."
> 
> That makes me wonder.  I don't even see how you
> could try to "modify the markers of the overlay"
> (with Lisp).

I believe that remark is for C programming.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]