Subject: bug#21730: 25.0.50; Random errors in redisplay--pre-redisplay-functions

From: Michael Welsh Duggan <[email-masked]>
Date: Sat, 31 Oct 2015 09:07:05 -0400

Michael Welsh Duggan <[email-masked]> writes:

> Eli Zaretskii <[email-masked]> writes:
>
>> From the backtrace it is obvious that the immediate reason for the
>> problem is the call to 'get-char-property' with an invalid 1st argument
>> of zero (it's a buffer position, so should be at least 1).
>>
>> Looking at 'cursor-sensor--detect', I see this:
>>
>>   (defun cursor-sensor--detect (window)
>>     (unless cursor-sensor-inhibit
>>       (let* ((point (window-point window))
>> 	     ;; It's often desirable to make the cursor-sensor-functions property
>> 	     ;; non-sticky on both ends, but that means get-pos-property might
>> 	     ;; never see it.
>> 	     (new (or (get-char-property point 'cursor-sensor-functions)
>> 		      (unless (bobp)
>> 			(get-char-property (1- point) 'cursor-sensor-functions))))
>>
>> So my guess is that the value of 'point' (the variable, not the
>> function) is 1, i.e. beginning of buffer, and subtracting 1 from it
>> produces that zero.  Then the second call to 'get-char-property' barfs
>> as expected.
>>
>> The code tries to protect itself against such a calamity by calling
>> 'bobp', but that function looks at the buffer's value of point, which
>> might be different from what 'window-point' returns.
>>
>> So my advice would be to replace the call to 'bobp' with an explicit
>> test of the value of the local variable 'point', and see if that fixes
>> the problem.
>
> I've changed the (bobp) to (= point 1).  I'll run it for a couple of
> weeks and report back.

This change seems to have done the trick.  I have not encountered the
error in several days.

-- 
Michael Welsh Duggan
([email-masked])