help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: [External] : Inspecting behaviour of `make-overlay', is this expecte


From: tomas
Subject: Re: [External] : Inspecting behaviour of `make-overlay', is this expected?
Date: Sun, 25 Dec 2022 07:44:35 +0100

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: signature.asc
Description: PGP signature


reply via email to

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