[Top][All Lists]

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

Re: info invisible changes

From: Kim F. Storm
Subject: Re: info invisible changes
Date: 14 Nov 2002 00:31:16 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

"Stefan Monnier" <monnier+gnu/emacs/address@hidden> writes:

> > 1) it doesn't test for 'invisible properties, so it happily processes
> >    invisible text when deciding the (visible) width of the lines,
> Are you sure ?  It uses current-column which does pay attention
> to `invisible' properties.

It works in relation to fill, yes.

But in general, the behaviour of current-column is "questionable" when
the buffer contains invisible newlines.  Consider the following code:

(let ((b (get-buffer-create "current-column test")))
   (set-buffer b)
   (insert "abc\ndef\nghi")
   (add-text-properties 4 5 '(invisible t))
   (add-text-properties 8 9 '(invisible t))
   ;; buffer now displays as one line: abcdefghi
   ;; position on the `h'
   (goto-char 10)

It creates a buffer with the following data line (where # indicates an
invisible newline):


I.e. the visible result is:


Here, current-column claims that `h' is in column 1.

This is because current_column_1 uses scan_newline to find the
line start, but scan_newline doesn't skip over invisible newlines...

> > 3) when the fill code inserts a newline to wrap the text, it may
> >    insert that newline in an invisible part of the buffer, so it has
> >    no visible effect (i.e. displaying one very long line rather than
> >    two normal width lines).
> You can fix this easily.  See fill-nobreak-predicate.

Thanks.  I learn something new every day.


reply via email to

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