Function: turn-on-xterm-mouse-tracking-on-terminal
turn-on-xterm-mouse-tracking-on-terminal is a byte-compiled function
defined in xt-mouse.el.gz.
Signature
(turn-on-xterm-mouse-tracking-on-terminal &optional TERMINAL)
Documentation
Enable xterm mouse tracking on TERMINAL.
Source Code
;; Defined in /usr/src/emacs/lisp/xt-mouse.el.gz
(defun turn-on-xterm-mouse-tracking-on-terminal (&optional terminal)
"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?
(not (string= (terminal-name terminal) "initial_terminal")))
(unless (terminal-parameter terminal 'xterm-mouse-mode)
;; Simulate selecting a terminal by selecting one of its frames
;; so that we can set the terminal-local `input-decode-map'.
(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))
(let ((enable (xterm-mouse-tracking-enable-sequence))
(disable (xterm-mouse-tracking-disable-sequence)))
(condition-case err
(send-string-to-terminal enable 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 enable (terminal-parameter nil 'tty-mode-set-strings))
(push disable (terminal-parameter nil 'tty-mode-reset-strings))
(set-terminal-parameter terminal 'xterm-mouse-mode t)
(set-terminal-parameter terminal 'xterm-mouse-utf-8
xterm-mouse-utf-8)))))