-Turn it on to use emacs mouse commands, and off to use xterm mouse commands."
- (interactive "P")
- (if (or (and (null arg) xterm-mouse-mode)
- (<= (prefix-numeric-value arg) 0))
- ;; Turn it off
- (if xterm-mouse-mode
- (progn
- (turn-off-xterm-mouse-tracking)
- (setq xterm-mouse-mode nil
- mouse-position-function nil)
- (set-buffer-modified-p (buffer-modified-p))))
- ;;Turn it on
- (unless (or window-system xterm-mouse-mode)
- (setq xterm-mouse-mode t
- mouse-position-function #'xterm-mouse-position-function)
- (turn-on-xterm-mouse-tracking)
- (set-buffer-modified-p (buffer-modified-p)))))
+Turn it on to use Emacs mouse commands, and off to use xterm mouse commands.
+This works in terminal emulators compatible with xterm. It only
+works for simple uses of the mouse. Basically, only non-modified
+single clicks are supported. 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."
+ :global t :group 'mouse
+ (if xterm-mouse-mode
+ ;; Turn it on
+ (unless window-system
+ (setq mouse-position-function #'xterm-mouse-position-function)
+ (turn-on-xterm-mouse-tracking))
+ ;; Turn it off
+ (turn-off-xterm-mouse-tracking 'force)
+ (setq mouse-position-function nil)))