bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Michael Welsh Duggan
Subject: bug#21730: 25.0.50; Random errors in redisplay--pre-redisplay-functions
Date: Tue, 27 Oct 2015 00:19:13 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Michael Welsh Duggan <mwd@md5i.com>
>> Date: Thu, 22 Oct 2015 00:04:06 -0400
>> 
>> I don't have a recipe for this.  Every now again I get the following in
>> my *Messages* buffer:
>> 
>>   redisplay--pre-redisplay-functions: (args-out-of-range 0)
>> 
>> I turned on debug-on-error, and got the following backtrace:
>> 
>>   Debugger entered--Lisp error: (args-out-of-range 0)
>>     get-char-property(0 cursor-sensor-functions)
>>     cursor-sensor--detect(#<window 224 on *Group*>)
>>     run-hook-with-args(cursor-sensor--detect #<window 224 on *Group*>)
>>     redisplay--pre-redisplay-functions(t)
>>     apply(redisplay--pre-redisplay-functions t)
>>     #[128 "\300\301\"\210\300\302\"\207" [apply 
>> redisplay--pre-redisplay-functions ignore nil] 4 nil nil](t)
>>     redisplay_internal\ \(C\ function\)()
>> 
>> This happens infrequently, about a couple of times a day.  I cannot make
>> this happen on demand, but I can add debugging code if led in the
>> correct direction.
>
> Thanks for reporting this.  I'll try to help, although Stefan might
> have better ideas.
>
> 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.

-- 
Michael Welsh Duggan
(md5i@md5i.com)





reply via email to

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