unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: <tomas@tuxteam.de>
To: help-gnu-emacs@gnu.org
Subject: Re: [External] : Inspecting behaviour of `make-overlay', is this expected?
Date: Sun, 25 Dec 2022 07:44:35 +0100	[thread overview]
Message-ID: <Y6fxU/h5EGQ2RQpx@tuxteam.de> (raw)
In-Reply-To: <SJ0PR10MB5488A7037DE865EFDCF5A771F3EE9@SJ0PR10MB5488.namprd10.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 1114 bytes --]

On Sat, Dec 24, 2022 at 04:39:55PM +0000, Drew Adams wrote:
> > > XXXXXXXXXX
> > > ^
> > > | position 0 in buffer
> > 
> > Position 1.  Buffer positions start with 1.
> > 
> > Try (make-overlay 1 11).
> 
> You _can_ pass 0 to `make-overlay', but it
> creates the overlay starting at position 1.

Same as if you pass -12 as start position: it gets rounded (if
you allow that expression ;-) up to 1:

  (overlay-start (make-overlay 0 10))
  => 1

> E.g. (make-overlay 0 10) creates an overlay
> from the first position, 1, through the 9th
> (as Eli mentioned).
> 
> As (elisp) `Managing Overlays' tells you:
> 
>  Function: make-overlay start end &optional buffer front-advance
>            rear-advance
>      This function creates and returns an overlay that belongs to BUFFER
>      and ranges from START to END.  Both START and END must specify
>      buffer positions; they may be integers or markers
> 
> You can use `overlay-start' and `overlay-end'
> to see the limits of your overlay.

I often use `eval-expression' and friends to clear up those
things.

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

      reply	other threads:[~2022-12-25  6:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-24  7:52 Inspecting behaviour of `make-overlay', is this expected? Jean Louis
2022-12-24  8:36 ` Eli Zaretskii
2022-12-24 16:32   ` Jean Louis
2022-12-25  8:03   ` Marcin Borkowski
2022-12-25 11:10     ` Jean Louis
2022-12-24 16:30 ` [External] : " Drew Adams
2022-12-24 16:34   ` Jean Louis
2022-12-24 16:39   ` Drew Adams
2022-12-25  6:44     ` tomas [this message]

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=Y6fxU/h5EGQ2RQpx@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=help-gnu-emacs@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.
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).