* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 @ 2014-04-30 22:01 Ishmael 2014-05-01 16:01 ` Stefan Monnier 2014-05-03 1:45 ` Glenn Morris 0 siblings, 2 replies; 24+ messages in thread From: Ishmael @ 2014-04-30 22:01 UTC (permalink / raw) To: 17378 To reproduce this bug: tmux emacs -nw C-x 3 C-x 3 Scroll UP with mouse's scroll wheel in RIGHTMOST window only causes: xterm-mouse-event: Wrong type argument: wholenump, -6 Note that scrolling down works in rightmost window. Also, both scroll up and scroll down work in all other windows. In my .emacs, I have: ;; Enable mouse support in non-GUI mode (emacs -nw) (unless window-system (require 'mouse) (xterm-mouse-mode t) (global-set-key [mouse-4] '(lambda () (interactive) (scroll-down 5))) (global-set-key [mouse-5] '(lambda () (interactive) (scroll-up 5))) (defun track-mouse (e)) (setq mouse-sel-mode t) ) -- View this message in context: http://emacs.1067599.n5.nabble.com/24-3-1-xterm-mouse-event-Wrong-type-argument-wholenump-6-tp321010.html Sent from the Emacs - Bugs mailing list archive at Nabble.com. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-04-30 22:01 bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 Ishmael @ 2014-05-01 16:01 ` Stefan Monnier 2014-05-01 16:35 ` Josh 2014-05-03 1:45 ` Glenn Morris 1 sibling, 1 reply; 24+ messages in thread From: Stefan Monnier @ 2014-05-01 16:01 UTC (permalink / raw) To: Ishmael; +Cc: 17378 [ Haven't gotten back to my machine with scroll mouse yet, so haven't tried it yet. ] > (global-set-key [mouse-4] '(lambda () [...] > (global-set-key [mouse-5] '(lambda () Please don't quote your lambdas. Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-01 16:01 ` Stefan Monnier @ 2014-05-01 16:35 ` Josh 2014-05-01 17:03 ` Stefan Monnier 0 siblings, 1 reply; 24+ messages in thread From: Josh @ 2014-05-01 16:35 UTC (permalink / raw) To: Stefan Monnier; +Cc: 17378, Ishmael On Thu, May 1, 2014 at 9:01 AM, Stefan Monnier <monnier@iro.umontreal.ca> wrote: > > Please don't quote your lambdas. Please excuse the digression, but is the reasoning for this documented somewhere? I couldn't find anything related in the elisp manual or the `lambda' docstring, though I did find the warning about quoted lambda forms not being compiled in `byte-compile-fset'. Are there other reasons that might affect even uncompiled code? ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-01 16:35 ` Josh @ 2014-05-01 17:03 ` Stefan Monnier 2014-05-01 17:05 ` Josh 0 siblings, 1 reply; 24+ messages in thread From: Stefan Monnier @ 2014-05-01 17:03 UTC (permalink / raw) To: Josh; +Cc: 17378, Ishmael > Are there other reasons that might affect even uncompiled code? Yes: lexical-binding. Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-01 17:03 ` Stefan Monnier @ 2014-05-01 17:05 ` Josh 2014-05-01 18:02 ` Stefan Monnier 0 siblings, 1 reply; 24+ messages in thread From: Josh @ 2014-05-01 17:05 UTC (permalink / raw) To: Stefan Monnier; +Cc: 17378, Ishmael On Thu, May 1, 2014 at 10:03 AM, Stefan Monnier <monnier@iro.umontreal.ca> wrote: >> Are there other reasons that might affect even uncompiled code? > > Yes: lexical-binding. Ah, ok. Thanks. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-01 17:05 ` Josh @ 2014-05-01 18:02 ` Stefan Monnier 2014-05-01 18:38 ` Ishmael 0 siblings, 1 reply; 24+ messages in thread From: Stefan Monnier @ 2014-05-01 18:02 UTC (permalink / raw) To: Josh; +Cc: 17378, Ishmael >> Yes: lexical-binding. > Ah, ok. Thanks. But more importantly, think of all those poor African kids starving while you waste precious bytes. Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-01 18:02 ` Stefan Monnier @ 2014-05-01 18:38 ` Ishmael 0 siblings, 0 replies; 24+ messages in thread From: Ishmael @ 2014-05-01 18:38 UTC (permalink / raw) To: 17378 Excellent point. Sally Struthers would be displeased. -- View this message in context: http://emacs.1067599.n5.nabble.com/24-3-1-xterm-mouse-event-Wrong-type-argument-wholenump-6-tp321010p321051.html Sent from the Emacs - Bugs mailing list archive at Nabble.com. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-04-30 22:01 bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 Ishmael 2014-05-01 16:01 ` Stefan Monnier @ 2014-05-03 1:45 ` Glenn Morris 2014-05-03 22:40 ` Ishmael 1 sibling, 1 reply; 24+ messages in thread From: Glenn Morris @ 2014-05-03 1:45 UTC (permalink / raw) To: Ishmael; +Cc: 17378 Ishmael wrote: > tmux > emacs -nw > C-x 3 > C-x 3 > > Scroll UP with mouse's scroll wheel in RIGHTMOST window only causes: > xterm-mouse-event: Wrong type argument: wholenump, -6 > > Note that scrolling down works in rightmost window. Also, both scroll up > and scroll down work in all other windows. > > In my .emacs, I have: > > ;; Enable mouse support in non-GUI mode (emacs -nw) > (unless window-system > (require 'mouse) > (xterm-mouse-mode t) > (global-set-key [mouse-4] '(lambda () > (interactive) > (scroll-down 5))) > (global-set-key [mouse-5] '(lambda () > (interactive) > (scroll-up 5))) > (defun track-mouse (e)) > (setq mouse-sel-mode t) > ) FWIW, I cannot reproduce this problem on RHEL 6.5 with tmux 1.6-3, xterm "X.Org 6.8.99.903(253)", and Emacs 24.3. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-03 1:45 ` Glenn Morris @ 2014-05-03 22:40 ` Ishmael 2014-05-04 4:17 ` Stefan Monnier 2014-05-04 18:08 ` Eli Zaretskii 0 siblings, 2 replies; 24+ messages in thread From: Ishmael @ 2014-05-03 22:40 UTC (permalink / raw) To: 17378 Apparently, this bug is somehow related to PuTTY, which I use to connect from my Windows machine to a Linux (CentOS) box. I'm unable to reproduce the bug on a native Linux host (or rather, a VirtualBox VM running Ubuntu on my Windows machine). The more exact steps to get the bug are: PuTTY + SSH to Linux tmux emacs -nw junk.txt (where junk.txt just contains 50 random lines) Scroll to the bottom using mouse wheel. C-x 3 (this creates a new buffer window to the right with a copy of the text) With the mouse, click on a line in this new, rightmost window. Scroll to the top using the mouse wheel. C-x 3 (a third window is created to the right) With the mouse, click on a line in the new, rightmost window. Scroll to the bottom using the mouse wheel. C-x 3 (a fourth window is created to the right) With the mouse, click on a line and attempt to scroll up with the mouse wheel. Up-scrolling is frozen, yielding the error message originally described. Sometimes, the third window freezes. To get the behavior consistently, I have to open four windows. -- View this message in context: http://emacs.1067599.n5.nabble.com/24-3-1-xterm-mouse-event-Wrong-type-argument-wholenump-6-tp321010p321198.html Sent from the Emacs - Bugs mailing list archive at Nabble.com. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-03 22:40 ` Ishmael @ 2014-05-04 4:17 ` Stefan Monnier 2014-05-04 18:08 ` Eli Zaretskii 1 sibling, 0 replies; 24+ messages in thread From: Stefan Monnier @ 2014-05-04 4:17 UTC (permalink / raw) To: Ishmael; +Cc: 17378 > Apparently, this bug is somehow related to PuTTY, which I use to connect from > my Windows machine to a Linux (CentOS) box. I'm unable to reproduce the bug > on a native Linux host (or rather, a VirtualBox VM running Ubuntu on my > Windows machine). It's probably easy to fix even if we don't understand fully the origin of the problem and can't reproduce it on our end. Could you try to get (and shows us) a backtrace (use Options => Enter Debugger on Error)? Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-03 22:40 ` Ishmael 2014-05-04 4:17 ` Stefan Monnier @ 2014-05-04 18:08 ` Eli Zaretskii 2014-05-04 18:35 ` Ishmael 1 sibling, 1 reply; 24+ messages in thread From: Eli Zaretskii @ 2014-05-04 18:08 UTC (permalink / raw) To: Ishmael; +Cc: 17378 > Date: Sat, 3 May 2014 15:40:21 -0700 (PDT) > From: Ishmael <noone.junkmail@gmail.com> > > Apparently, this bug is somehow related to PuTTY, which I use to connect from > my Windows machine to a Linux (CentOS) box. I'm unable to reproduce the bug > on a native Linux host (or rather, a VirtualBox VM running Ubuntu on my > Windows machine). > > The more exact steps to get the bug are: > PuTTY + SSH to Linux > tmux > emacs -nw junk.txt (where junk.txt just contains 50 random lines) > Scroll to the bottom using mouse wheel. > C-x 3 (this creates a new buffer window to the right with a copy of the > text) > With the mouse, click on a line in this new, rightmost window. Scroll to > the top using the mouse wheel. > C-x 3 (a third window is created to the right) > With the mouse, click on a line in the new, rightmost window. Scroll to the > bottom using the mouse wheel. > C-x 3 (a fourth window is created to the right) > With the mouse, click on a line and attempt to scroll up with the mouse > wheel. > Up-scrolling is frozen, yielding the error message originally described. I cannot reproduce this. Please set debug-on-error to a non-nil value, and show the backtrace that is produced when the error happens. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-04 18:08 ` Eli Zaretskii @ 2014-05-04 18:35 ` Ishmael 2014-05-05 1:43 ` Stefan Monnier 0 siblings, 1 reply; 24+ messages in thread From: Ishmael @ 2014-05-04 18:35 UTC (permalink / raw) To: 17378 Here's the backtrace. Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil) xterm-mouse--read-event-sequence-1000() xterm-mouse-event(nil) xterm-mouse-translate-1() xterm-mouse-translate(nil) -- View this message in context: http://emacs.1067599.n5.nabble.com/24-3-1-xterm-mouse-event-Wrong-type-argument-wholenump-6-tp321010p321242.html Sent from the Emacs - Bugs mailing list archive at Nabble.com. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-04 18:35 ` Ishmael @ 2014-05-05 1:43 ` Stefan Monnier 2014-05-05 15:52 ` Ishmael 0 siblings, 1 reply; 24+ messages in thread From: Stefan Monnier @ 2014-05-05 1:43 UTC (permalink / raw) To: Ishmael; +Cc: 17378 > Here's the backtrace. > Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil) > xterm-mouse--read-event-sequence-1000() > xterm-mouse-event(nil) > xterm-mouse-translate-1() > xterm-mouse-translate(nil) Good, thanks. Just one more detail: do M-x load-library RET xt-mouse.el RET before producing the backtrace, so we get the backtrace of the uncompiled code, which should give us many more details. My guess is that xterm-mouse-last is somehow still nil sometimes (and other times its value comes from yet elsewhere). So the patch below should hopefully avoid the crash. It will probably end up generating incorrect events instead (e.g. mouse-1 when you release the mouse-3 button). Stefan === modified file 'lisp/xt-mouse.el' --- lisp/xt-mouse.el 2014-04-20 02:29:38 +0000 +++ lisp/xt-mouse.el 2014-05-05 01:40:59 +0000 @@ -161,10 +161,10 @@ (cond ((>= code 64) (format "mouse-%d" (- code 60))) ((memq code '(8 9 10)) - (setq xterm-mouse-last code) + (setq xterm-mouse-last (- code 8)) (format "M-down-mouse-%d" (- code 7))) ((= code 11) - (format "M-mouse-%d" (- xterm-mouse-last 7))) + (format "M-mouse-%d" (+ 1 (or xterm-mouse-last 0)))) ((= code 3) ;; For buttons > 5 xterm only reports a ;; button-release event. Avoid error by mapping ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-05 1:43 ` Stefan Monnier @ 2014-05-05 15:52 ` Ishmael 2014-05-05 18:20 ` Stefan Monnier 0 siblings, 1 reply; 24+ messages in thread From: Ishmael @ 2014-05-05 15:52 UTC (permalink / raw) To: 17378 Here you go. Debugger entered--Lisp error: (wrong-type-argument wholenump -6) posn-at-x-y(-6 58) (nthcdr 2 (posn-at-x-y x y)) (append (list nil (quote menu-bar)) (nthcdr 2 (posn-at-x-y x y))) (if w (posn-at-x-y (- x left) (- y top) w t) (append (list nil (quote menu-bar)) (nthcdr 2 (posn-at-x-y x y)))) (let ((event (if w (posn-at-x-y (- x left) (- y top) w t) (append (list nil (quote menu-bar)) (nthcdr 2 (posn-at-x-y x y)))))) (setcar (nthcdr 3 event) timestamp) event) (list type (let ((event (if w (posn-at-x-y (- x left) (- y top) w t) (append (list nil (quote menu-bar)) (nthcdr 2 (posn-at-x-y x y)))))) (setcar (nthcdr 3 event) timestamp) event)) (setq last-input-event (list type (let ((event (if w (posn-at-x-y (- x left) (- y top) w t) (append (list nil ...) (nthcdr 2 ...))))) (setcar (nthcdr 3 event) timestamp) event))) (let* ((click (cond ((null extension) (xterm-mouse--read-event-sequence-1000)) ((eq extension 1006) (xterm-mouse--read-event-sequence-1006)) (t (error "Unsupported XTerm mouse protocol")))) (type (nth 0 click)) (x (nth 1 click)) (y (nth \ 2 click)) (timestamp (xterm-mouse-truncate-wrap (* 1000 (- (float-time) (or xt-mouse-epoch (setq xt-mouse-epoch ...)))))) (w (window-at x y)) (ltrb (window-edges w)) (left (nth 0 ltrb)) (top (nth 1 ltrb))) (set-terminal-parameter nil (quot\ e xterm-mouse-x) x) (set-terminal-parameter nil (quote xterm-mouse-y) y) (setq last-input-event (list type (let ((event (if w (posn-at-x-y ... ... w t) (append ... ...)))) (setcar (nthcdr 3 event) timestamp) event)))) xterm-mouse-event(nil) (let* ((xterm-mouse-last nil) (down (xterm-mouse-event extension)) (down-command (nth 0 down)) (down-data (nth 1 down)) (down-where (nth 1 down-data)) (down-binding (key-binding (if (symbolp down-where) (vector down-where down-command) (\ vector down-command)))) (is-click (string-match "^mouse" (symbol-name (car down))))) (if is-click nil (if (cond ((null extension) (and (eq (read-event) 27) (eq (read-event) 91) (eq (read-event) 77))) ((eq extension 1006) (and (eq (read-eve\ nt) 27) (eq (read-event) 91) (eq (read-event) 60)))) nil (error "Unexpected escape sequence from XTerm"))) (let* ((click (if is-click down (xterm-mouse-event extension))) (click-data (nth 1 click)) (click-where (nth 1 click-data))) (if (me\ mq down-binding (quote (nil ignore))) (if (and (symbolp click-where) (consp click-where)) (vector (list click-where click-data) click) (vector click)) (setq unread-command-events (append (if (eq down-where click-where) (list click) (list (\ list ... click-data) (if ... 0 ...))) unread-command-events)) (if xterm-mouse-debug-buffer (print unread-command-events xterm-mouse-debug-buffer)) (if (and (symbolp down-where) (consp down-where)) (vector (list down-where down-data) down) \ (vector down))))) (progn (deactivate-mark) (let* ((xterm-mouse-last nil) (down (xterm-mouse-event extension)) (down-command (nth 0 down)) (down-data (nth 1 down)) (down-where (nth 1 down-data)) (down-binding (key-binding (if (symbolp down-where) (vector d\ own-where down-command) (vector down-command)))) (is-click (string-match "^mouse" (symbol-name (car down))))) (if is-click nil (if (cond ((null extension) (and (eq ... 27) (eq ... 91) (eq ... 77))) ((eq extension 1006) (and (eq ... 27) (eq\ ... 91) (eq ... 60)))) nil (error "Unexpected escape sequence from XTerm"))) (let* ((click (if is-click down (xterm-mouse-event extension))) (click-data (nth 1 click)) (click-where (nth 1 click-data))) (if (memq down-binding (quote (nil i\ gnore))) (if (and (symbolp click-where) (consp click-where)) (vector (list click-where click-data) click) (vector click)) (setq unread-command-events (append (if (eq down-where click-where) (list click) (list ... ...)) unread-command-event\ s)) (if xterm-mouse-debug-buffer (print unread-command-events xterm-mouse-debug-buffer)) (if (and (symbolp down-where) (consp down-where)) (vector (list down-where down-data) down) (vector down)))))) (unwind-protect (progn (deactivate-mark) (let* ((xterm-mouse-last nil) (down (xterm-mouse-event extension)) (down-command (nth 0 down)) (down-data (nth 1 down)) (down-where (nth 1 down-data)) (down-binding (key-binding (if (symbolp down-\ where) (vector down-where down-command) (vector down-command)))) (is-click (string-match "^mouse" (symbol-name (car down))))) (if is-click nil (if (cond ((null extension) (and ... ... ...)) ((eq extension 1006) (and ... ... ...))) nil (err\ or "Unexpected escape sequence from XTerm"))) (let* ((click (if is-click down (xterm-mouse-event extension))) (click-data (nth 1 click)) (click-where (nth 1 click-data))) (if (memq down-binding (quote (nil ignore))) (if (and (symbolp click\ -where) (consp click-where)) (vector (list click-where click-data) click) (vector click)) (setq unread-command-events (append (if ... ... ...) unread-command-events)) (if xterm-mouse-debug-buffer (print unread-command-events xterm-mouse-de\ bug-buffer)) (if (and (symbolp down-where) (consp down-where)) (vector (list down-where down-data) down) (vector down)))))) (set-window-configuration wconfig)) (let ((wconfig (current-window-configuration))) (unwind-protect (progn (deactivate-mark) (let* ((xterm-mouse-last nil) (down (xterm-mouse-event extension)) (down-command (nth 0 down)) (down-data (nth 1 down)) (down-where (nth 1 down-data\ )) (down-binding (key-binding (if ... ... ...))) (is-click (string-match "^mouse" (symbol-name ...)))) (if is-click nil (if (cond (... ...) (... ...)) nil (error "Unexpected escape sequence from XTerm"))) (let* ((click (if is-click down ..\ .)) (click-data (nth 1 click)) (click-where (nth 1 click-data))) (if (memq down-binding (quote ...)) (if (and ... ...) (vector ... click) (vector click)) (setq unread-command-events (append ... unread-command-events)) (if xterm-mouse-debug\ -buffer (print unread-command-events xterm-mouse-debug-buffer)) (if (and ... ...) (vector ... down) (vector down)))))) (set-window-configuration wconfig))) (save-excursion (let ((wconfig (current-window-configuration))) (unwind-protect (progn (deactivate-mark) (let* ((xterm-mouse-last nil) (down (xterm-mouse-event extension)) (down-command (nth 0 down)) (down-data (nth 1 down)) (down-where \ (nth 1 down-data)) (down-binding (key-binding ...)) (is-click (string-match "^mouse" ...))) (if is-click nil (if (cond ... ...) nil (error "Unexpected escape sequence from XTerm"))) (let* ((click ...) (click-data ...) (click-where ...)) (i\ f (memq down-binding ...) (if ... ... ...) (setq unread-command-events ...) (if xterm-mouse-debug-buffer ...) (if ... ... ...))))) (set-window-configuration wconfig)))) xterm-mouse-translate-1() xterm-mouse-translate(nil) -- View this message in context: http://emacs.1067599.n5.nabble.com/24-3-1-xterm-mouse-event-Wrong-type-argument-wholenump-6-tp321010p321296.html Sent from the Emacs - Bugs mailing list archive at Nabble.com. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-05 15:52 ` Ishmael @ 2014-05-05 18:20 ` Stefan Monnier 2014-05-05 18:43 ` Eli Zaretskii 2014-05-05 23:18 ` Stefan Monnier 0 siblings, 2 replies; 24+ messages in thread From: Stefan Monnier @ 2014-05-05 18:20 UTC (permalink / raw) To: Ishmael; +Cc: 17378 > Debugger entered--Lisp error: (wrong-type-argument wholenump -6) [..full backtrace..] Thanks. So this seems to be a different bug from the last one: not only the error signaled is different, but the backtrace is fairly different as well. If you bump into a full backtrace for the other bug, I'd be happy to see it as well. Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-05 18:20 ` Stefan Monnier @ 2014-05-05 18:43 ` Eli Zaretskii 2014-05-05 23:18 ` Stefan Monnier 1 sibling, 0 replies; 24+ messages in thread From: Eli Zaretskii @ 2014-05-05 18:43 UTC (permalink / raw) To: Stefan Monnier; +Cc: 17378, noone.junkmail > From: Stefan Monnier <monnier@iro.umontreal.ca> > Date: Mon, 05 May 2014 14:20:56 -0400 > Cc: 17378@debbugs.gnu.org > > > Debugger entered--Lisp error: (wrong-type-argument wholenump -6) > [..full backtrace..] > > Thanks. So this seems to be a different bug from the last one: not only > the error signaled is different, but the backtrace is fairly different > as well. This was the original error reported by the OP, see the Subject line. I wonder how come xterm-mouse--read-event-sequence-1000 returns a negative X coordinate of the mouse click. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-05 18:20 ` Stefan Monnier 2014-05-05 18:43 ` Eli Zaretskii @ 2014-05-05 23:18 ` Stefan Monnier 2014-05-06 3:07 ` Ishmael 1 sibling, 1 reply; 24+ messages in thread From: Stefan Monnier @ 2014-05-05 23:18 UTC (permalink / raw) To: Ishmael; +Cc: 17378 >> Debugger entered--Lisp error: (wrong-type-argument wholenump -6) > [..full backtrace..] > Thanks. So this seems to be a different bug from the last one: not only > the error signaled is different, but the backtrace is fairly different > as well. > If you bump into a full backtrace for the other bug, I'd be happy to see it > as well. One more thing: for both backtraces (the wholenump in xterm-mouse-event and the integerp in xterm-mouse--read-event-sequence-1000), could show additionally to the detailed backtrace (i.e. obtained after loading the uncompiled xt-mouse.el file), the M-x view-lossage output, as well as a description of the event that caused the crash (wheel scroll, or a mouse click, in which case specify which mouse button was pressed and where). Apparently, Emacs is receiving a byte sequence that does not correspond to what it expects. So we can easily make the code "robust" in the sense that it will not signal an error, but in order to make sure the code does something useful it'd be better to try and understand what is the byte-sequence we receive and how it should be interpreted. Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-05 23:18 ` Stefan Monnier @ 2014-05-06 3:07 ` Ishmael 2014-05-06 19:10 ` Stefan Monnier 0 siblings, 1 reply; 24+ messages in thread From: Ishmael @ 2014-05-06 3:07 UTC (permalink / raw) To: 17378 Hmm, both errors were caused by a mouse wheel UP scroll (down works). I'm not sure what caused one error versus the other, and I can't seem to reproduce the integerp error. Here's the view-lossage report for the wholenump error. C-x 3 ESC [ M SPC V B ESC [ M # V B ESC [ M a V B ESC [ M # V B ESC [ M a V B ESC [ M # V B ESC [ M a V B ESC [ M # V B ESC [ M a V B ESC [ M # V B ESC [ M a V B ESC [ M a V B ESC [ M a V B ESC [ M SPC \263 A ESC [ M # \263 A ESC [ M ` \260 ? ESC [ M ` \260 ? ESC [ M ` \260 ? ESC [ M ` \260 ? ESC [ M ` \260 ? ESC [ M ` \260 ? ESC [ M ` \260 ? ESC [ M ` \260 ? ESC [ M ` \260 ? ESC [ M ` \260 ? ESC [ M a \260 ? ESC [ M # \260 ? ESC [ M a \260 ? ESC [ M # \260 ? ESC [ M a \260 ? ESC [ M # \260 ? ESC [ M a \260 ? ESC [ M # \260 ? ESC [ M a \260 ? ESC [ M a \260 ? ESC [ M a \260 ? ESC [ M a \260 ? ESC [ M a \260 ? ESC [ M a \260 ? C-x 3 ESC [ M SPC \334 5 ESC [ M # \334 5 ESC [ M 5 ESC [ ESC [ M 5 ESC [ ESC [ M 5 ESC [ ESC [ M 5 ESC [ ESC x v i e w - l o TAB RET -- View this message in context: http://emacs.1067599.n5.nabble.com/24-3-1-xterm-mouse-event-Wrong-type-argument-wholenump-6-tp321010p321314.html Sent from the Emacs - Bugs mailing list archive at Nabble.com. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-06 3:07 ` Ishmael @ 2014-05-06 19:10 ` Stefan Monnier 2014-05-07 2:00 ` Ishmael 0 siblings, 1 reply; 24+ messages in thread From: Stefan Monnier @ 2014-05-06 19:10 UTC (permalink / raw) To: Ishmael; +Cc: 17378 > ESC [ M SPC \263 A That's down-mouse-1 (at position 147,33) > ESC [ M # \263 A That's the matching up-mouse, mapped (via xterm-mouse-last) to mouse-1. > ESC [ M ` \260 ? That's (up-)mouse-4. There's no matching down-mouse-4 and that's normal. > ESC [ M a \260 ? That's (up-)mouse-5. There's no matching down-mouse-5 and that's normal. > ESC [ M # \260 ? Hmm... that's an "up-mouse" but there was preceding down-mouse, so we don't know the button number to use. The code defaults to map it to `mouse-1' but we really have no idea. > ESC [ M a \260 ? > ESC [ M # \260 ? Same pair seen a few times. > ESC [ M a \260 ? > ESC [ M a \260 ? And here we see (up-)mouse-5 events not followed by the odd "up-mouse", so that makes those "up-mouse" even more strange: sometimes the "ESC [ M a" is followed by a "ESC [ M #" and sometimes not. I guess rather than map those lone "up-mouse" events to `mouse-1' we should just drop them in the floor. > C-x 3 OK. > ESC [ M SPC \334 5 > ESC [ M # \334 5 That's a good down-mouse-1 + mouse-1 (at position 188,21) > ESC [ M 5 ESC [ Hmm... this "5" is an unknown button code. And it would be at position -5,59, which is not valid. Can you try the following: - do the C-x 3 dance to set up the windows in the problematic way. - move your mouse to the problematic place. - click mouse buttons 1, 2, 3, 4, 5 in this order (mouse-4 is "wheel-up") and all at the exact same position (i.e. without moving the mouse between the clicks). - move the mouse a bit. - click mouse buttons 1, 2, 3, 4, 5 again. - show us the resulting view-lossage. So we can try and guess what this weird "ESC [ M 5 ESC [" is about. Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-06 19:10 ` Stefan Monnier @ 2014-05-07 2:00 ` Ishmael 2014-05-07 13:43 ` Stefan Monnier 0 siblings, 1 reply; 24+ messages in thread From: Ishmael @ 2014-05-07 2:00 UTC (permalink / raw) To: 17378 Here you go. I did it a couple times, just in case. ESC [ M SPC > 4 ESC [ M # > 4 ESC [ M a > 4 ESC [ M # > 4 ESC [ M a > 4 ESC [ M # > 4 ESC [ M a > 4 ESC [ M # > 4 ESC [ M a > 4 ESC [ M # > 4 C-x 3 ESC [ M SPC \253 / ESC [ M # \253 / ESC [ M ` \253 / ESC [ M # \253 / ESC [ M ` \253 / ESC [ M # \253 / ESC [ M ` \253 / ESC [ M # \253 / ESC [ M ` \253 / ESC [ M # \253 / ESC [ M ` \253 / ESC [ M ` \253 / C-x 3 ESC [ M SPC \335 3 ESC [ M # \335 3 ESC [ M ! \335 3 ESC [ M # \335 3 ESC [ M " \335 3 ESC [ M # \335 3 ESC [ M a \335 3 ESC [ M # \335 3 ESC [ M 3 ESC [ ESC [ M 3 ESC [ ESC [ M 3 ESC [ ESC [ M 3 ESC [ ESC [ M 3 ESC [ ESC [ M 3 ESC [ ESC [ M SPC \360 > ESC [ M # \360 > ESC [ M ! \360 > ESC [ M # \360 > ESC [ M " \360 > ESC [ M # \360 > ESC [ M a \360 > ESC [ M # \360 > ESC [ M > ESC [ ESC [ M > ESC [ ESC [ M > ESC [ ESC x v i e w - l o TAB RET ESC [ M SPC < < ESC [ M # < < ESC [ M a < < ESC [ M # < < ESC [ M a < < ESC [ M # < < C-x 3 ESC [ M SPC \247 7 ESC [ M # \247 7 ESC [ M ` \247 7 ESC [ M # \247 7 ESC [ M ` \247 7 ESC [ M # \247 7 ESC [ M ` \247 7 C-x 3 ESC [ M SPC \341 1 ESC [ M # \341 1 ESC [ M ! \341 1 ESC [ M # \341 1 ESC [ M " \341 1 ESC [ M # \341 1 ESC [ M a \341 1 ESC [ M # \341 1 ESC [ M 1 ESC [ ESC [ M 1 ESC [ ESC [ M SPC \360 ) ESC [ M # \360 ) ESC [ M ! \360 ) ESC [ M # \360 ) ESC [ M " \360 ) ESC [ M # \360 ) ESC [ M a \360 ) ESC [ M # \360 ) ESC [ M ) ESC [ ESC [ M ) ESC [ ESC x v i e w - l TAB RET -- View this message in context: http://emacs.1067599.n5.nabble.com/24-3-1-xterm-mouse-event-Wrong-type-argument-wholenump-6-tp321010p321372.html Sent from the Emacs - Bugs mailing list archive at Nabble.com. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-07 2:00 ` Ishmael @ 2014-05-07 13:43 ` Stefan Monnier 2014-05-07 18:39 ` Ishmael 0 siblings, 1 reply; 24+ messages in thread From: Stefan Monnier @ 2014-05-07 13:43 UTC (permalink / raw) To: Ishmael; +Cc: 17378 > Here you go. I did it a couple times, just in case. Thanks. Can you correlate my decoding below with what you've actually done? > ESC [ M SPC > 4 > ESC [ M # > 4 down-mouse-1 + mouse-1, at position 30,20 > ESC [ M a > 4 > ESC [ M # > 4 That would be mouse-5 + the weird "up-mouse". Still at position 30,20. > ESC [ M a > 4 > ESC [ M # > 4 > ESC [ M a > 4 > ESC [ M # > 4 > ESC [ M a > 4 > ESC [ M # > 4 Repeated 3 more times. > C-x 3 I think we all know this one. > ESC [ M SPC \253 / > ESC [ M # \253 / down-mouse-1 + mouse-1, at position 139,15 > ESC [ M ` \253 / > ESC [ M # \253 / That would be mouse-4 + the weird "up-mouse". Still at position 139,15. > ESC [ M ` \253 / > ESC [ M # \253 / > ESC [ M ` \253 / > ESC [ M # \253 / > ESC [ M ` \253 / > ESC [ M # \253 / Repeated 3 more times. > ESC [ M ` \253 / > ESC [ M ` \253 / The same mouse-4 again, repeated twice but this time without the weird "up-mouse". > C-x 3 OK. > ESC [ M SPC \335 3 > ESC [ M # \335 3 down-mouse-1 + mouse-1, at position 189,19 > ESC [ M ! \335 3 > ESC [ M # \335 3 down-mouse-2 + mouse-2, at position 189,19 > ESC [ M " \335 3 > ESC [ M # \335 3 down-mouse-3 + mouse-3, at position 189,19 > ESC [ M a \335 3 > ESC [ M # \335 3 mouse-5 + weird "up-mouse", at position 189,19 > ESC [ M 3 ESC [ > ESC [ M 3 ESC [ > ESC [ M 3 ESC [ > ESC [ M 3 ESC [ > ESC [ M 3 ESC [ > ESC [ M 3 ESC [ Hmm... no idea what this is. > ESC [ M SPC \360 > > ESC [ M # \360 > down-mouse-1 + mouse-1, at position 208,30 > ESC [ M ! \360 > > ESC [ M # \360 > down-mouse-2 + mouse-2, at position 208,30 > ESC [ M " \360 > > ESC [ M # \360 > down-mouse-3 + mouse-3, at position 208,30 > ESC [ M a \360 > > ESC [ M # \360 > mouse-5 + weird "up-mouse", at position 189,19 > ESC [ M > ESC [ > ESC [ M > ESC [ > ESC [ M > ESC [ Still no clue. > ESC x v i e w - l o TAB RET OK, first part done.------------------------------------------------------- > ESC [ M SPC < < > ESC [ M # < < down-mouse-1 + mouse-1, at position 28,28 > ESC [ M a < < > ESC [ M # < < > ESC [ M a < < > ESC [ M # < < Twice: mouse-5 + weird "up-mouse", at position 28,28 > C-x 3 OK > ESC [ M SPC \247 7 > ESC [ M # \247 7 down-mouse-1 + mouse-1, at position 135,23 > ESC [ M ` \247 7 > ESC [ M # \247 7 mouse-4 + weird "up-mouse". Still at position 135,15. > ESC [ M ` \247 7 > ESC [ M # \247 7 Repeated. > ESC [ M ` \247 7 Again but without the "up-mouse". > C-x 3 OK > ESC [ M SPC \341 1 > ESC [ M # \341 1 down-mouse-1 + mouse-1, at position 193,17 > ESC [ M ! \341 1 > ESC [ M # \341 1 down-mouse-2 + mouse-2, at position 193,17 > ESC [ M " \341 1 > ESC [ M # \341 1 down-mouse-3 + mouse-3, at position 193,17 > ESC [ M a \341 1 > ESC [ M # \341 1 mouse-5 + weird up-mouse, at position 193,17 > ESC [ M 1 ESC [ > ESC [ M 1 ESC [ Even less clue since now the ">" has turned into "1". > ESC [ M SPC \360 ) > ESC [ M # \360 ) down-mouse-1 + mouse-1, at position 208,9 > ESC [ M ! \360 ) > ESC [ M # \360 ) down-mouse-2 + mouse-2, at position 208,9 > ESC [ M " \360 ) > ESC [ M # \360 ) down-mouse-3 + mouse-3, at position 208,9 > ESC [ M a \360 ) > ESC [ M # \360 ) mouse-5 + weird up-mouse, at position 208,9 > ESC [ M ) ESC [ > ESC [ M ) ESC [ In your earlier email, you had a "ESC [ M 5 ESC ["; so far we've seen "ESC [ M ?? ESC [" with ?? equal to ">", "1", "5", and now ")". One thing I notice is that in the 1,2,3,4,5 series, the 4 appears to be missing. Was that an oversight on your part, or did you do the scroll up, then scroll down? If you did do the up and the down, some of the "weird up-mouse" thingies might actually stand for the mouse-4! OTOH, those come after the mouse-5 events. Could it be that you did wheel-down then wheel-up rather than the reverse (the notion of up and down in this context often leads to confusion)? Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-07 13:43 ` Stefan Monnier @ 2014-05-07 18:39 ` Ishmael 2014-05-08 1:15 ` Stefan Monnier 0 siblings, 1 reply; 24+ messages in thread From: Ishmael @ 2014-05-07 18:39 UTC (permalink / raw) To: 17378 Nice analysis! I did scroll-down first, then scroll-up. I'll do it again, this time typing '1', '2', etc. before each action, for clarity. C-x 3 ESC [ M ` \245 O ESC [ M SPC \245 O ESC [ M # \245 O ESC [ M a \245 O ESC [ M # \245 O ESC [ M a \245 O ESC [ M # \245 O ESC [ M a \245 O ESC [ M # \245 O ESC [ M a \245 O ESC [ M # \245 O ESC [ M a \245 O ESC [ M a \245 O ESC [ M a \245 O C-x 3 ESC [ M SPC \337 = ESC [ M # \337 = 1 ESC [ M SPC \337 = ESC [ M # \337 = 2 ESC [ M ! \337 = ESC [ M # \337 = 3 ESC [ M " \337 = ESC [ M # \337 = 4 ESC [ M a \337 = ESC [ M a \337 = ESC [ M a \337 = 5 ESC [ M = ESC [ ESC [ M = ESC [ ESC [ M = m o v e 1 ESC [ M SPC \362 2 ESC [ M # \362 2 2 ESC [ M ! \362 2 ESC [ M # \362 2 3 ESC [ M " \362 2 ESC [ M # \362 2 4 ESC [ M a \362 2 ESC [ M # \362 2 ESC [ M a \362 2 ESC [ M a \362 2 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 [ ESC x v i e w - l o TAB RET -- View this message in context: http://emacs.1067599.n5.nabble.com/24-3-1-xterm-mouse-event-Wrong-type-argument-wholenump-6-tp321010p321443.html Sent from the Emacs - Bugs mailing list archive at Nabble.com. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-07 18:39 ` Ishmael @ 2014-05-08 1:15 ` Stefan Monnier 2020-09-20 21:34 ` Lars Ingebrigtsen 0 siblings, 1 reply; 24+ messages in thread From: Stefan Monnier @ 2014-05-08 1:15 UTC (permalink / raw) To: Ishmael; +Cc: 17378 > Nice analysis! I did scroll-down first, then scroll-up. I'll do it again, > this time typing '1', '2', etc. before each action, for clarity. Good idea, thanks. > C-x 3 > ESC [ M SPC \337 = > ESC [ M # \337 = > 1 > ESC [ M SPC \337 = > ESC [ M # \337 = > 2 > ESC [ M ! \337 = > ESC [ M # \337 = > 3 > ESC [ M " \337 = > ESC [ M # \337 = Looks all normal. > 4 > ESC [ M a \337 = > ESC [ M a \337 = > ESC [ M a \337 = So, while you think this should generate a mouse-4 event (aka "wheel-up"), this will generate mouse-5 events (aka "wheel-down"), instead. Do you indeed see that it scrolls in the wrong direction? > 5 > ESC [ M = ESC [ > ESC [ M = ESC [ Hmm... so these weird entries are for the mouse-5 events? At least now we know what they look like: the ?? is the second part of the position. Which means that this can look like another mouse-N event. > ESC [ M = > m o v e Hmmm.... what was that? Where did the "ESC [" go? Did you type "move" or just "ve"? > 1 > ESC [ M SPC \362 2 > ESC [ M # \362 2 > 2 > ESC [ M ! \362 2 > ESC [ M # \362 2 > 3 > ESC [ M " \362 2 > ESC [ M # \362 2 Again, this looks normal. > 4 > ESC [ M a \362 2 > ESC [ M # \362 2 > ESC [ M a \362 2 > ESC [ M a \362 2 But here we have a "spurious up-mouse" event in between. So we should try and ignore them. > 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). Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 2014-05-08 1:15 ` Stefan Monnier @ 2020-09-20 21:34 ` Lars Ingebrigtsen 0 siblings, 0 replies; 24+ messages in thread From: Lars Ingebrigtsen @ 2020-09-20 21:34 UTC (permalink / raw) To: Stefan Monnier; +Cc: 17378, Ishmael Stefan Monnier <monnier@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 ^ permalink raw reply related [flat|nested] 24+ messages in thread
end of thread, other threads:[~2020-09-20 21:34 UTC | newest] Thread overview: 24+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-04-30 22:01 bug#17378: 24.3.1: xterm-mouse-event: Wrong type argument: wholenump, -6 Ishmael 2014-05-01 16:01 ` Stefan Monnier 2014-05-01 16:35 ` Josh 2014-05-01 17:03 ` Stefan Monnier 2014-05-01 17:05 ` Josh 2014-05-01 18:02 ` Stefan Monnier 2014-05-01 18:38 ` Ishmael 2014-05-03 1:45 ` Glenn Morris 2014-05-03 22:40 ` Ishmael 2014-05-04 4:17 ` Stefan Monnier 2014-05-04 18:08 ` Eli Zaretskii 2014-05-04 18:35 ` Ishmael 2014-05-05 1:43 ` Stefan Monnier 2014-05-05 15:52 ` Ishmael 2014-05-05 18:20 ` Stefan Monnier 2014-05-05 18:43 ` Eli Zaretskii 2014-05-05 23:18 ` Stefan Monnier 2014-05-06 3:07 ` Ishmael 2014-05-06 19:10 ` Stefan Monnier 2014-05-07 2:00 ` Ishmael 2014-05-07 13:43 ` Stefan Monnier 2014-05-07 18:39 ` Ishmael 2014-05-08 1:15 ` Stefan Monnier 2020-09-20 21:34 ` Lars Ingebrigtsen
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.