all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Michael Welsh Duggan <mwd@md5i.com>
Cc: 21730@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	[thread overview]
Message-ID: <83vb9zt19o.fsf@gnu.org> (raw)
In-Reply-To: <87io5zh7m1.fsf@md5i.com>

> 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.





  reply	other threads:[~2015-10-22 14:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-22  4:04 bug#21730: 25.0.50; Random errors in redisplay--pre-redisplay-functions Michael Welsh Duggan
2015-10-22 14:40 ` Eli Zaretskii [this message]
2015-10-27  4:19   ` Michael Welsh Duggan
2015-10-31 13:07     ` Michael Welsh Duggan
2015-10-31 13:32       ` Eli Zaretskii
2016-09-14 17:01         ` Philipp Stephani
     [not found]         ` <CAArVCkTA5_hxvxszdYX1QWSoG382zg+mW=4U3uhiXmTBcPCSgw@mail.gmail.com>
2016-09-14 17:09           ` Eli Zaretskii
2016-09-14 18:43             ` Philipp Stephani
2016-09-14 19:23               ` Eli Zaretskii
2016-09-14 19:48                 ` Philipp Stephani
2016-09-15 14:22                   ` Eli Zaretskii
2016-09-14 19:11           ` Philipp Stephani
2016-09-14 19:25             ` Eli Zaretskii
2017-07-25  2:06               ` Sergio Durigan Junior
2017-07-25 14:21                 ` Eli Zaretskii
2017-07-25 23:15                   ` Sergio Durigan Junior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83vb9zt19o.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=21730@debbugs.gnu.org \
    --cc=mwd@md5i.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.