emacs-devel
[Top][All Lists]
Advanced

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

Re: Something is rotten with end-of-line and move-end-of-line


From: Lőrentey Károly
Subject: Re: Something is rotten with end-of-line and move-end-of-line
Date: Mon, 28 Nov 2005 21:17:59 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.52 (gnu/linux)

David Kastrup <address@hidden> writes:
> address@hidden (Lőrentey Károly) writes:
>> Lőrentey Károly <address@hidden> writes:
>>> The difference (a difference?) is inside fields:
>>> `{beginning,end}-of-line' moves to the beginning/end of the field,
>>> while `move-{beginning,end}-of-line' stops at the field boundaries:
>>
>> Sorry, I meant `move-{beginning,end}-of-line' goes to the actual line ends.
>
> Both doc strings claim to merely go to the field boundaries:

Indeed, there are some bugs.

`end-of-line' does stop at the current field's boundary, although
repeated executions escape from the field.  However,
`move-end-of-line' always jumps over the end of the field, which is
clearly wrong.

`move-beginning-of-line' is similarly broken, but only if the field
property isn't front-sticky.  Otherwise both `beginning-of-line' and
`move-beginning-of-line' stop at the field boundary, and they stay
there if repeated.

Try this test in a fundamental buffer:

        (let ((s "Test Normal Front-sticky Test"))
          (add-text-properties 5 11 '(face widget-field field foo) s)
          (add-text-properties 12 24 '(face widget-field field bar front-sticky 
t) s)
          (insert s))

Thus, the current behaviour is clearly broken.  It is not clear,
however, what C-a/C-e is supposed to do when point is on a field
boundary.

* * *

Meanwhile, I found an archived discussion thread which explains the
intended difference between the two flavours:

        http://thread.gmane.org/gmane.emacs.devel/34012

        From: Kim F. Storm
        Subject: move-beginning-of-line
        Date: 2005-03-01 23:01:16 GMT
        Message-ID: <address@hidden>

There is a test case given in the discussion that demonstrates the
original problem:

        (progn
         (insert "\nab")
         (insert-image-file "../etc/splash.xpm")
         (move-end-of-line 1) 
         (insert "def\n"))

move-b/e-of-line move across the image to the line ending that
corresponds to what is displayed on the screen, while the builtin
b/e-of-line variants stop at the hidden newlines embedded in the image
file.

Funnily enough, on closer inspection the doc string do indicate this
difference:

,----[ C-h f move-beginning-of-line RET
| Move point to beginning of current display line.
|                                    ^^^^^^^
`----

,----[ C-h f beginning-of-line RET
| Move point to beginning of current line.
`----

Obviously this needs to be elaborated.

-- 
Károly




reply via email to

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