Function: xterm-mouse-mode

xterm-mouse-mode is an autoloaded, interactive and byte-compiled function defined in xt-mouse.el.gz.

Signature

(xterm-mouse-mode &optional ARG)

Documentation

Toggle XTerm mouse mode.

Turn it on to use Emacs mouse commands, and off to use xterm mouse commands. This works in terminal emulators compatible with xterm. When turned on, the normal xterm mouse functionality for such clicks is still available by holding down the SHIFT key while pressing the mouse button.

On text terminals that Emacs knows are compatible with the mouse as well as other critical editing functionality, this is automatically turned on at startup. See Info node (elisp)Terminal-Specific and xterm--init.

This is a global minor mode. If called interactively, toggle the Xterm-Mouse mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate (default-value \=xterm-mouse-mode)'.

The mode's hook is called both when the mode is enabled and when it is disabled.

Probably introduced at or before Emacs version 19.30.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/xt-mouse.el.gz
;;;###autoload
(define-minor-mode xterm-mouse-mode
  "Toggle XTerm mouse mode.

Turn it on to use Emacs mouse commands, and off to use xterm mouse
commands.  This works in terminal emulators compatible with xterm.  When
turned on, the normal xterm mouse functionality for such clicks is still
available by holding down the SHIFT key while pressing the mouse button.

On text terminals that Emacs knows are compatible with the mouse as well
as other critical editing functionality, this is automatically turned on
at startup.  See Info node `(elisp)Terminal-Specific' and `xterm--init'."
  :global t :group 'mouse
  :version "31.1"
  (setq xterm-mouse-mode-called t)
  (funcall (if xterm-mouse-mode 'add-hook 'remove-hook)
           'terminal-init-xterm-hook
           'turn-on-xterm-mouse-tracking-on-terminal)
  (if xterm-mouse-mode
      ;; Turn it on
      (progn
        (setq mouse-position-function #'xterm-mouse-position-function
              tty-menu-calls-mouse-position-function t)
        (mapc #'turn-on-xterm-mouse-tracking-on-terminal (terminal-list)))
    ;; Turn it off
    (mapc #'turn-off-xterm-mouse-tracking-on-terminal (terminal-list))
    (setq mouse-position-function nil
          tty-menu-calls-mouse-position-function nil)))