unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Cc: Luc Teirlinck <teirllm@dms.auburn.edu>, emacs-devel@gnu.org
Subject: Re: move-beginning-of-line
Date: Tue, 15 Mar 2005 23:23:10 +0100	[thread overview]
Message-ID: <x5oedkr1kh.fsf@lola.goethe.zz> (raw)
In-Reply-To: <m3fyyywsd6.fsf@kfs-l.imdomain.dk> (Kim F. Storm's message of "Mon, 14 Mar 2005 09:20:53 +0100")

storm@cua.dk (Kim F. Storm) writes:

> Luc Teirlinck <teirllm@dms.auburn.edu> 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?

Where the overlay is used to give a different appearance to buffer
parts (where the text of those buffer parts is under user control), it
is not possible to avoid.

> For example, this is how insert-image-file works.
> Try to eval this in an empty buffer:
>
> (progn
>  (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?

As I said, preview-latex moves point out of images, so the cursor will
usually end up at the start of the image.  The effect is probably not
annoying enough as to cause people to complain.  preview-latex really
puts only a thin veil over the covered entities: if you move with
<left> or <right> into a preview, it unfolds again, and the same if
you search for text or do a query-replace.

So when editing, people understand that they are not dealing with the
equivalent of characters.  It is only when they are looking at the
screen that they want the illusion.

For example, we have had to stop AUCTeX from formatting stuff like

This is a very long line and continues for a while and then we have $E
  = mc^2$ and then the line continues for another while.

since preview-latex would make a single visual line like

This is a very long line and continues for a while and then we have [E=mc²] and then the line continues for another while.

out of it.  So we tricked AUCTeX into using formatting rules that
would "coincidentally" keep newlines out of inner structures as long
as they could be avoided.  And if they could not be avoided, it would
break just behind them, at least optionally.

>> 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.
>
> True.

False.  When Emacs 21.1 was coming up, I was plastering Gerd with bug
reports.  All sorts of cute little display errors, in particular
involving newlines.  Emacs took _quite_ a bit of beating in that area.
Now that was catering for inconsistent displays: cursor movement and
similar are not necessarily involved.  I'd be interested in seeing
stuff like auto-fill work sensibly in the presence of display
properties.  The best behavior for stuff like preview-latex would
probably result if filling kept track of both the visual line size as
well as the real buffer line size and caused a break when either was
exceeded.  Something like that.  But I guess this would not be a
sensible filling default in the general case of text properties, just
a nice option to have for preview-latex.  The sensible default would
probably just cater for what is visible, meaning that it would skip
across any display properties (filling changes inside of them don't
change the appearance).

> 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).

I am somewhat skeptical that this can be fixes in general...

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

  parent reply	other threads:[~2005-03-15 22:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-01 23:01 move-beginning-of-line Kim F. Storm
2005-03-14  2:58 ` move-beginning-of-line Luc Teirlinck
2005-03-14  8:20   ` move-beginning-of-line Kim F. Storm
2005-03-14 16:48     ` move-beginning-of-line Ralf Angeli
2005-03-14 17:31       ` move-beginning-of-line David Kastrup
2005-03-14 17:52         ` move-beginning-of-line Ralf Angeli
2005-03-14 18:48       ` move-beginning-of-line Stefan Monnier
2005-03-15 18:38         ` move-beginning-of-line Richard Stallman
2005-03-15 18:39     ` move-beginning-of-line Richard Stallman
2005-03-15 22:23     ` David Kastrup [this message]
     [not found] ` <m364zqibx2.fsf@zsu.sush.org>
2005-03-17 15:34   ` move-beginning-of-line Kim F. Storm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x5oedkr1kh.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=teirllm@dms.auburn.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).