GNU bug report logs - #17378
24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6

Previous Next

Package: emacs;

Reported by: Ishmael <noone.junkmail <at> gmail.com>

Date: Wed, 30 Apr 2014 22:13:02 UTC

Severity: normal

Tags: fixed

Found in version 24.3.1

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #76 received at 17378 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 17378 <at> debbugs.gnu.org, Ishmael <noone.junkmail <at> gmail.com>
Subject: Re: bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument:
 wholenump, -6
Date: Sun, 20 Sep 2020 23:34:15 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> 5
>> ESC [ M 2 ESC [
>> ESC [ M 2 ESC [
>> ESC [ M 2 ESC [
>> ESC [ M 2 ESC [
>> ESC [ M 2 ESC [
>> ESC [ M 2 ESC [
>
> And here, again the "ESC [ M ?? ESC [" form for the mouse-5.
> I don't think there's much hope to support this mouse-5 click format.
> Looks like a bug somewhere in the terminal (or something stacked in
> between, like screen/pmux).

This was the final message in the thread six years ago, so I wonder
whether it's likely whether we'll make further progress here.  Instead
we can make xterm-mouse-event more defensive here and check whether the
click event is valid (like in the patch below).

Looking at the backtrace, I think this should fix the reported bug, so
I've installed it in Emacs 28.

diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index 2b9fab556e..362d29b943 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -237,7 +237,10 @@ xterm-mouse-event
 		      (xterm-mouse--read-event-sequence extension))
 		     (t
 		      (error "Unsupported XTerm mouse protocol")))))
-    (when click
+    (when (and click
+               ;; In very obscure circumstances, the click may become
+               ;; invalid (see bug#17378).
+               (>= (nth 1 click) 0))
       (let* ((type (nth 0 click))
              (x    (nth 1 click))
              (y    (nth 2 click))


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 4 years and 242 days ago.

Previous Next


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