Subject: bug#3400: bug in add-text-properties

From: Werner LEMBERG <[email-masked]>
Date: Thu, 28 May 2009 18:26:58 +0200 (CEST)

>> The first line properly disappears, however, the first character in
>> the now visible part of the buffer (the letter `a') makes problems:
>> It incorrectly refers to the character at buffer position 1 (the
>> digit `1').  In particular, `C-u C-x =' for letter `a' shows
>>
>> ---
>>
>>         character: 1 (49, #o61, #x31)
> [...]
>> There are text properties here:
>>   intangible           t
>>   invisible            t
>
> `add-text-properties' describes the character after point and when
> you call `describe-char' point is at the beginning of the buffer.

Hmm.  If I have

   12345
   ABCDE

and I make `12345' + the newline after the `5' invisible and
intangible, I see

  ABCDE

in the buffer.  If the blinking cursor stays on the `A', and you press
`C-x =', do you *really* expect to see the properties of character `1'
instead of `A'?  This is completely counterintuitive IMHO.

> So IMHO this is not a bug in `add-text-properties'.

Maybe.  I don't know the internal details of Emacs.  However, calling
add-text-properties triggers the problem I experience.

> It's arguable whether point should be allowed to be there in your
> case,

In this particular case I don't care where `point' is.  I want to get
the correct result of `C-x ='.

> but then where to move point when the entire buffer is invisible?

This might be handled as a special case.

>> A side effect is that `C-a' no longer moves to the beginning of the
>> line.
>
> A side effect of what?

Of calling add-text-properties as described in my report.  I do expect
that C-a moves the blinking cursor to the beginning of the line and
not to the *second* character in the buffer, letter `B'.

    Werner