GNU bug report logs - #21730
25.0.50; Random errors in redisplay--pre-redisplay-functions

Previous Next

Package: emacs;

Reported by: Michael Welsh Duggan <mwd <at> md5i.com>

Date: Thu, 22 Oct 2015 04:05:02 UTC

Severity: normal

Found in version 25.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Welsh Duggan <mwd <at> md5i.com>
Cc: 21730 <at> debbugs.gnu.org
Subject: bug#21730: 25.0.50; Random errors in redisplay--pre-redisplay-functions
Date: Thu, 22 Oct 2015 17:40:19 +0300
> From: Michael Welsh Duggan <mwd <at> 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.




This bug report was last modified 7 years and 360 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.