emacs-devel
[Top][All Lists]
Advanced

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

Re: `vertical-motion', `goto-line' set point to invisible text


From: Eli Zaretskii
Subject: Re: `vertical-motion', `goto-line' set point to invisible text
Date: Mon, 04 Jul 2011 23:06:40 +0300

> From: Stefan Monnier <address@hidden>
> Cc: address@hidden,  address@hidden
> Date: Mon, 04 Jul 2011 14:10:11 -0400
> 
> >> >> AFAIK none of those positions are *inside* invisible text
> >> > Try "M-x describe-text-properties RET", and you will see this isn't
> >> > true.
> >> AFAIK, describe-text-properties describes the properties of the char
> >> *after* point, so if you're at the beginning of invisible text (yet not
> >> inside it), describe-text-properties will show the `invisible' property.
> 
> > So how many character positions are invisible after this:
> >        (insert "line1\nline2\nline3\n")
> >        (goto-line 2)
> >        (put-text-property (line-beginning-position)
> >                           (line-beginning-position 2)
> >                           'invisible 'invis1)
> > ?
> 
> Without running the code, I'd say 6 ("line2\n").  Why?

Because with your reasoning it's only 5.

> >   (progn (switch-to-buffer "test")
> >      (insert "aline1\nbline2\ncline3\n")
> >      (goto-line 2)
> >      (put-text-property (line-beginning-position)
> >                         (line-beginning-position 2)
> >                         'invisible 'invis1)
> >      (add-to-invisibility-spec 'invis1)
> >      (goto-char (point-max)))
> 
> > Eval this in *scratch*, then type "C-p C-x =".  You will see that
> > Emacs reports that point is position 8 and the character at point is
> > `b', whereas what is shown (correctly) under the cursor is `c' whose
> > buffer position is 15.  Do you think this is correct behavior?
> 
> In this area, I don't think there's a clear cut definition of what is
> correct and what is not.

??? How could having a cursor on `c' and reporting it on `b' be
"correct" by any measure?

> If point is anywhere between "bline2\n" the display will be identical,
> so the fact that the cursor is drawn over the "c" that follows it does
> not necessarily imply that point should be "at the end of "bline2\n",
> since the cursor is also drawn right after the "aline1\n" and by that
> logic point should be at the beginning of "bline2\n".

But what about the fact that you cannot have point at position 15,
which is outside the invisible portion?  How can that be anything but
a bug?



reply via email to

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