emacs-devel
[Top][All Lists]
Advanced

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

Re: invisible


From: Stephen Berman
Subject: Re: invisible
Date: Fri, 23 Nov 2007 19:19:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

On Fri, 23 Nov 2007 15:25:19 +0100 martin rudalics <address@hidden> wrote:

>> With (forward-line -1) there is also no line skipping,
>> but this is also the case without setting the rear-nonsticky property to
>> t, i.e., I see no difference, in contrast to C-p.  The value of
>> track-eol is nil (the default).  So I am not sure what problems you
>> mean.
>
> Assigning the rear-sticky property affects where `point' is set by
> scan_newline which does the line-end serching in `forward-line'.  Not
> setting the rear-nonsticky property skips the line ends with the
> invisible property, at least on my system.  Since `previous-line' and
> `next-line' both rely on `forward-line' to skip lines, I can't imagine
> how you do not see the problem with the latter.  Please try again.

I cannot see a difference with forward-line.  I did this:

1. I inserted the following lines into each of the buffers a and b:
line1
line2
line3
line4
line5
line6
line7

2. In buffer a I did 
M-: (progn (put-text-property 6 7 `invisible t)
           (put-text-property 12 13 `invisible t)
           (put-text-property 18 19 `invisible t)
           (put-text-property 24 25 `invisible t)
           (put-text-property 30 31 `invisible t))


3. In buffer b I did
M-: (progn (add-text-properties 6 7 '(invisible t rear-nonsticky t))
           (add-text-properties 12 13 '(invisible t rear-nonsticky t))
           (add-text-properties 18 19 '(invisible t rear-nonsticky t))
           (add-text-properties 24 25 '(invisible t rear-nonsticky t))
           (add-text-properties 30 31 '(invisible t rear-nonsticky t)))

4. Via Customize I toggled line-move-ignore-invisible off and set it for
the current session.  I left track-eol at its default value nil.

5. In buffer a with point at (point-max), repeatedly typing C-p goes
like this, with `^' marking successive positions of the cursor:
line1line2line3line4line5line6
^    ^         ^         ^
line7
^

6. In buffer b with point at (point-max), repeatedly typing C-p goes
like this:
line1line2line3line4line5line6
^    ^   ^     ^    ^    ^
line7
^

7. In both buffer a and buffer b with point at (point-max), repeatedly
typing 'M-: (forward-line -1)' goes like in 6:
line1line2line3line4line5line6
^    ^         ^         ^
line7
^

Set track-eol to t does not make any difference for 5, 6, 7.  Setting
line-move-ignore-invisible to t makes C-p move point from the beginning
of line 7 to the beginning of line 1 in both buffers a and b, while 'M-:
(forward-line -1)' continues to behave as in 7.

>>>In current development Emacs, the cursor stays put, i.e., C-p is a no-op
>>>>here; the same goes for every position in line 3, except the beginning
>>>>of the line: here C-p goes to the beginning of line 1 (the parenthetical
>>>>comment doesn't make sense, unless it is a typo for line 1, or maybe he
>>>>means the mode line should display L2 instead of L3, even though the
>>>>cursor stays put).
>>>
>>>This seems like a bug in `line-move-finish', please try the attached
>>>patch (untested).
>>
>>
>> With your patch typing C-p, with the cursor at any position in line 3
>> but the beginning of the line, moves the cursor to the beginning of line
>> 3, i.e., does the same thing as C-a.  I think I would have expected it
>> to put the cursor on line 1.  (At the beginning of line 3 the behavior
>> is as before, C-p goes to the beginning of line 1.)
>
> Did you assign the rear-nonsticky property?  It won't work without that
> property due to the behavior of the point setting mechanism.

I inserted the following lines into buffer c:

line1
line2
line3
line4

and typed `M-: (add-text-properties 7 13 '(invisible t rear-nonsticky
t))'.  Then I evalled line-move-finish with your patch applied.  With
line-move-ignore-invisible set to nil I get the behavior I described
(C-p on line 3 behaving like C-a except at the beginning of the line).
(The value of track-eol makes no difference here.)

>> Summarizing, it appears that rear-nonsticky should be set to t when a
>> position is given the invisible property.  In particular,
>> facemenu-set-invisible should be changed accordingly, otherwise the menu
>> choice Edit->Text Properties->Special Properties->Invisible admits the
>> observed motion misbehavior.  (But I don't know if there are other cases
>> where facemenu-set-invisible should leave the invisible position
>> rear-sticky.)  This still does not fix the problem with C-p at positions
>> other than the beginning of the line after an invisible line, but your
>> patch for that also results in unexpected behavior.
>
> Setting rear-nonsticky is _not_ sufficient, you have to do something as
> in my patch in order to handle `line-move-ignore-invisible' correctly.
> Please try again (1) with the property set, (2) with and without my
> patch applied, and (3) with both values for `line-move-ignore-invisible'
> and `track-eol'.

I hope my descriptions above are clear enough.

On Fri, 23 Nov 2007 15:37:28 +0100 martin rudalics <address@hidden> wrote:

>> Setting rear-nonsticky is _not_ sufficient, you have to do something as
>> in my patch in order to handle `line-move-ignore-invisible' correctly.
>> Please try again (1) with the property set, (2) with and without my
>> patch applied, and (3) with both values for `line-move-ignore-invisible'
>> and `track-eol'.
>
> Forgot to say (4) starting C-p / C-n at line-beginnings and -ends in
> order to test the "track-eol" behavior.

The only difference I see is in buffer a when the cursor is at the end
of line 7 (actually, anywhere but at the beginning), then typing C-p
repeatedly does not skip any lines.  This is regardless of the setting
of track-eol.

Steve Berman





reply via email to

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