summaryrefslogtreecommitdiff
path: root/lisp/xt-mouse.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2014-07-01 12:10:02 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2014-07-01 12:10:02 -0400
commit854b22ea18090cc226703c4a828a3fc0bfaa0ccd (patch)
tree0189621ae31693c9b157d3b3bc7e5edb7f918ec6 /lisp/xt-mouse.el
parent005f996739e9b59e01b3c10f153efb4c4e54353d (diff)
* lisp/xt-mouse.el (turn-on-xterm-mouse-tracking-on-terminal)
(turn-off-xterm-mouse-tracking-on-terminal): Don't burp if the terminal is suspended. Fixes: debbugs:17857
Diffstat (limited to 'lisp/xt-mouse.el')
-rw-r--r--lisp/xt-mouse.el19
1 files changed, 16 insertions, 3 deletions
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index f9e89880dae..e5e77405b02 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -312,7 +312,8 @@ terminals that support it.")
"Enable xterm mouse tracking on TERMINAL."
(when (and xterm-mouse-mode (eq t (terminal-live-p terminal))
;; Avoid the initial terminal which is not a termcap device.
- ;; FIXME: is there more elegant way to detect the initial terminal?
+ ;; FIXME: is there more elegant way to detect the initial
+ ;; terminal?
(not (string= (terminal-name terminal) "initial_terminal")))
(unless (terminal-parameter terminal 'xterm-mouse-mode)
;; Simulate selecting a terminal by selecting one of its frames
@@ -320,7 +321,13 @@ terminals that support it.")
(with-selected-frame (car (frames-on-display-list terminal))
(define-key input-decode-map "\e[M" 'xterm-mouse-translate)
(define-key input-decode-map "\e[<" 'xterm-mouse-translate-extended))
- (send-string-to-terminal xterm-mouse-tracking-enable-sequence terminal)
+ (condition-case err
+ (send-string-to-terminal xterm-mouse-tracking-enable-sequence
+ terminal)
+ ;; FIXME: This should use a dedicated error signal.
+ (error (if (equal (cadr err) "Terminal is currently suspended")
+ nil ;The sequence will be sent upon resume.
+ (signal (car err) (cdr err)))))
(push xterm-mouse-tracking-enable-sequence
(terminal-parameter nil 'tty-mode-set-strings))
(push xterm-mouse-tracking-disable-sequence
@@ -338,7 +345,13 @@ terminals that support it.")
;; command too many times (or to catch an unintended key sequence), than
;; to send it too few times (or to fail to let xterm-mouse events
;; pass by untranslated).
- (send-string-to-terminal xterm-mouse-tracking-disable-sequence terminal)
+ (condition-case err
+ (send-string-to-terminal xterm-mouse-tracking-disable-sequence
+ terminal)
+ ;; FIXME: This should use a dedicated error signal.
+ (error (if (equal (cadr err) "Terminal is currently suspended")
+ nil
+ (signal (car err) (cdr err)))))
(setf (terminal-parameter nil 'tty-mode-set-strings)
(remq xterm-mouse-tracking-enable-sequence
(terminal-parameter nil 'tty-mode-set-strings)))