emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: invisible


From: Stefan Monnier
Subject: Re: invisible
Date: Wed, 08 Dec 2004 21:02:01 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

> > > However, if the cursor is in the position indicated by "*", (point)
> > > returns *6*.
> > > 
> > >       ----
> > >       1234*
> > >      *1234
> > >       ----
> > > 
> > > I do believe this should result in 11.
> > 
> > I disagree.
> > Any value between 6 and 11 can be correct.  Which one is preferable depends
> > on the stickiness of the `invisible' text-property.  In your case the
> > property is rear-sticky, so in order for insertion of a char at point to
> > insert a visible char, point has to be 6, which is why Emacs chose to use
> > 6 in your example.
> 
> Is there any way that (point) returns 11 in Emacs 21.3.50?

Of course.  It can also return 10, 9, 8, and 7.  And any code you write
which assumes it's going to be 11 is bound to encounter problems sooner
or later.

> I did
>       (put-text-property 6 11 'rear-nonsticky t)
> but (point) still returns 6.

That makes it neither rear sticky nor front-sticky in which case either 6 or
11 is used depending on the phase of the moon (e.g. depends on whether
point is moving forward or backward, etc...).
Try (add-text-properties 6 11 '(rear-nonsticky t front-sticky t)) or
(add-text-properties 6 11 '(rear-nonsticky (invisible) front-sticky
(invisible))) or something like that (I rarely if ever fiddle with
stickiness).

> Note that both Emacs 20.7 and Emacs 21.3 returns 11.

I'm pretty sure they also sometimes return 10, 9, 8, 7, or 6 depending on
how you move point.  E.g. M-< C-5 C-f will most likely get you to
position 6.


        Stefan




reply via email to

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