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

From: Werner LEMBERG <[email-masked]>
Date: Thu, 28 May 2009 23:48:33 +0200 (CEST)

>> 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.
> 
> If you hit `b', the `b' will be inserted right before "12345", and it
> will not be invisible.

So what?  With `C-x =' I see `A' and get the data of `1', this is what
I consider a bug.  Actually, there is no way to retrieve information
from `A' at all.

> BTW, why are you using `intangible'?

I've just copied some code -- I haven't checked whether I can omit it.

BTW, the problem is not restricted to the beginning of the buffer.
With this input

  12345
  ABCDE
  abcde

and this lisp code

  (defun make-second-line-invisible ()
    (interactive)
    (goto-line 2)
    (setq start (line-beginning-position))
    (setq end (1+ (line-end-position))) ; handle \n
    (add-text-properties start
			 end
			 '(invisible t
			   intangible t)))

there is the same problem: After calling the function you get

  12345
  abcde

and `C-x =' (positioned on the `a') reports the info of the now
invisible character `A'.  Similarly, C-a only moves to character `b'.

    Werner