[Top][All Lists]

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

Re: move-beginning-of-line

From: Kim F. Storm
Subject: Re: move-beginning-of-line
Date: Mon, 14 Mar 2005 09:20:53 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Luc Teirlinck <address@hidden> writes:

> Kim Storm wrote:
>    As I indicated in another mail today, I have been looking at a problem
>    with moving to the beginning of a line in a window with the following
>    appearence:
>    abc
>     [     ]
>    x[IMAGE]yz
>     [     ]
>    def
>    Now, if I place the cursor on x, and do C-e, cursor moves to z.
>    If I then do C-a, cursor moves to y, not x.
>    The IMAGE is layed on top (via a display property) of text that ends
>    in a newline, so formally, C-a (beginning-of-line) DTRT.
>    However, from a user point of view, this is !TRT.
> Sorry for replying so late to this, but is there some extremely good
> (that is, absolutely unavoidable) reason why that image is layed on
> top of text that _ends in a newline_ (or just contains newlines)?  Is
> that fact, rather than beginning-of-line not the problem?  

For example, this is how insert-image-file works.
Try to eval this in an empty buffer:

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

This could be considered a bug in insert-image-file.

I wonder how preview-latex handles this, as it uses images over
multiline text _a lot_ ...?   Does beginning-of-line work ok
with images in the middle of lines?  If so, how?

>                                                            Trying to
> "fix" the C-a behavior you consider "wrong" using
> `move-beginning-of-line' is not going to change the fact that every
> other Emacs command or function will still consider the offending
> newline to be the end of a line _and_ to be visible (unless it has the
> invisibility property).  Giving newlines a display property is a very
> dubious thing to do.  I do not believe that very much in Emacs is
> prepared for newlines with a display property.


This _is_ a problem, but it is not new.

>    Contrary to what I previously thought, this is not caused by an error
>    in the move_it_vertically_backward function -- it is simply the way
>    bolp and beginning-of-line work, i.e. they don't care if the newline
>    before point is invisible.
> And on top of that, unless that newline has the invisibility property,
> Emacs considers it to be visible, whether the user can see it or not.

True.  I have tried to put invisibile property on the image text, but
it doesn't give good result for me ... anybody want to experiment
with that, to find something which works ?

If we can fix the places where a display property gives problems, I
guess we could get rid of move-beginning-of-line (or at least not
have it as the default binding for C-a).

Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

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