From eecc931e8dc58487cd710ef158fe1e216da0a717 Mon Sep 17 00:00:00 2001 From: Jared Finder Date: Mon, 9 Dec 2024 22:16:40 -0800 Subject: [PATCH] Enable xterm-mouse-mode by default in xterm * lisp/xt-mouse.el (xterm-mouse-mode): Change default value of xterm-mouse-mode to t. * lisp/term/xterm.el (xterm--init): Enable xterm-mouse-mode if the default value is still set. * etc/NEWS: Document new behavior. --- etc/NEWS | 6 ++++++ lisp/term/xterm.el | 2 ++ lisp/xt-mouse.el | 2 ++ 3 files changed, 10 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 3efce149dbf..aebcf30d84a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -41,6 +41,12 @@ why the mark trace buffer is enabled by default. * Startup Changes in Emacs 31.1 +** When run inside xterm, 'xterm-mouse-mode' is turned on by default. +This means that the mouse will work by default inside xterm terminals. +If your terminal does not behave properly with xterm mouse tracking +enabled, you can disable mouse tracking by putting '(xterm-mouse-mode +-1)' in your init file. + * Changes in Emacs 31.1 diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index 82f9a60b53b..c4f33cd0faa 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -907,6 +907,8 @@ xterm--init (when xterm-set-window-title (xterm--init-frame-title)) + (when xterm-mouse-mode + (xterm-mouse-mode 1)) ;; Unconditionally enable bracketed paste mode: terminals that don't ;; support it just ignore the sequence. (xterm--init-bracketed-paste-mode) diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index 8cbb44ece14..c77d763702c 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -358,6 +358,8 @@ xterm-mouse-mode mouse functionality for such clicks is still available by holding down the SHIFT key while pressing the mouse button." :global t :group 'mouse + :init-value t + :version "31.1" (funcall (if xterm-mouse-mode 'add-hook 'remove-hook) 'terminal-init-xterm-hook 'turn-on-xterm-mouse-tracking-on-terminal) -- 2.39.5