]> git.eshelyaron.com Git - emacs.git/commitdiff
t-mouse.el: Make sure we apply the setting to new terminals
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 30 Aug 2022 21:55:03 +0000 (17:55 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 30 Aug 2022 21:55:03 +0000 (17:55 -0400)
* lisp/t-mouse.el (gpm-mouse-tty-setup): New function.
(gpm-mouse-mode): Use it as well as `tty-setup-hook`.
* lisp/term/linux.el (terminal-init-linux): Remove gpm-specific code,
not neded any more.

lisp/t-mouse.el
lisp/term/linux.el

index cdfc30c879304755e56dad4bb28e6ce3126d3e23..7a4e7f330eaca0318225dd138097cc99cc5b5378 100644 (file)
@@ -62,6 +62,9 @@
     (gpm-mouse-stop))
   (set-terminal-parameter nil 'gpm-mouse-active nil))
 
+(defun gpm-mouse-tty-setup ()
+  (if gpm-mouse-mode (gpm-mouse-enable) (gpm-mouse-disable)))
+
 ;;;###autoload
 (define-minor-mode gpm-mouse-mode
   "Toggle mouse support in GNU/Linux consoles (GPM Mouse mode).
@@ -80,7 +83,9 @@ GPM.  This is due to limitations in GPM and the Linux kernel."
                         (terminal-parameter terminal 'gpm-mouse-active))))
       ;; Simulate selecting a terminal by selecting one of its frames ;-(
       (with-selected-frame (car (frames-on-display-list terminal))
-        (if gpm-mouse-mode (gpm-mouse-enable) (gpm-mouse-disable))))))
+        (gpm-mouse-tty-setup))))
+  (when gpm-mouse-mode
+    (add-hook 'tty-setup-hook #'gpm-mouse-tty-setup)))
 
 (provide 't-mouse)
 
index ab5a6d8698fb828cb6638bfdc87f2170783cd0ae..60bf91fcf52024e52022d8832ed89806beed3ef8 100644 (file)
@@ -15,8 +15,6 @@
   ;; Compositions confuse cursor movement.
   (setq-default auto-composition-mode "linux")
 
-  (ignore-errors (when gpm-mouse-mode (require 't-mouse) (gpm-mouse-enable)))
-
   ;; Don't translate ESC TAB to backtab as directed
   ;; by ncurses-6.3.
   (define-key input-decode-map "\e\t" nil)