unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: rms@gnu.org
Cc: eliz@gnu.org, emacs-devel@gnu.org
Subject: RE: Overlay insertion types, markers, etc.
Date: Wed, 20 Nov 2019 09:38:18 -0800 (PST)	[thread overview]
Message-ID: <f76c62de-52c4-432d-8e90-8978a3742580@default> (raw)
In-Reply-To: <E1iXSfA-0003iI-SE@fencepost.gnu.org>

>   > 1. Why, if you pass markers [to `make-overlay],
>   >    isn't the default to use the insertion types of
>   >    those markers?
> 
> I don't think I ever thought about the question back then.
> 
> Did pointers even have insertion types, back when
> overlays were first introduced?

No idea.  I know much less than you about this.

> However, the function calling convention would have
> to be complex to give you three options: yes, no,
> or inherit from the marker.

Not sure what you mean.  We already have the
ability to specify, using optional args, the
insertion types and the buffer.

The only question is where the _defaults_ for
those come from, i.e., when you don't specify
their optional args.

Today, the defaults ignore such info from any
marker args.  Today, the current buffer is the
default buffer, and the default for insertion
is "the overlay extends to include any text
inserted at the beginning, but not text inserted
at the end".

If we instead allowed the defaults to be taken
from marker args, and if someone wanted today's
default behavior, s?he would just pass a marker
position (`marker-position') instead of the
marker itself.

And as I mentioned to Eli, if two markers are
passed and they disagree wrt such things, then
the defaulting could be done as it is now:
ignore conflicting info from the markers.

E.g., if two markers have the same buffer (or
if only one of the position args passed is a
marker), use that `marker-buffer'.  Similarly,
for FRONT-ADVANCE and REAR-ADVANCE.

And yes, such a change in defaulting would
not be backward compatible - code that passes
markers and expects the default buffer and
default insertion behavior to be as now would
break.  Users would need to update such code
to use `marker-position'.

But again, I wasn't proposing that or anything
else.  I was just trying to understand why we
do what we do.

>   > 2. Why isn't there (or is there?) a simple way to
>   >    change the "marker insertion types" of an
>   >    existing overlay?
> 
> I never thought of adding it.
> 
>   > 3. 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?
> 
> I never thought about it.
> 
>   > 4. Can you retrieve the markers that are "used by"
>   >    an overlay, i.e., as markers?
> 
> If you could get at them, you could change their buffer positions.
> I think that would mess up the overlay sort order and cause bugs.
> You could also put them in another buffer and cause even worse
> trouble.

That's what Stefan said.  See my reply to him
about that:

https://lists.gnu.org/archive/html/emacs-devel/2019-11/msg00603.html

In particular, I think it's confusing for the
doc to talk about the _markers of an overlay_
(this is not about the markers that you pass to
`make-overlay'), since they are not markers in
the usual sense of being Lisp objects (that is,
visible and accessible from Lisp).

At least it confused me and prompted my questions.

Now that I understand a bit more, I'd suggest
that the doc be changed to remove mention of an
overlay having markers (internal though they are).
That doesn't add anything, I think, and it can
confuse.

It should be enough to say that, like a marker,
an overlay has a buffer and text-insertion
behavior.  In particular, the latter means that,
by default, an overlay advances when you insert
text before it.



  parent reply	other threads:[~2019-11-20 17:38 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
2019-11-20 16:17             ` Richard Stallman
2019-11-20 17:33               ` Eli Zaretskii
2019-11-20 17:38               ` Drew Adams [this message]
     [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=f76c62de-52c4-432d-8e90-8978a3742580@default \
    --to=drew.adams@oracle.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --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).