When I run emacsclient it does not respond to mouse clicks. My main Emacs process runs in a terminal and responds to mouse clicks correctly because I have the following code in my Emacs config file:
(xterm-mouse-mode 1)
Why does emacsclient not respond to mouse clicks? Is there a way to make it do so?
This is probably because certain settings in Emacs are specific to the terminal, and manipulating such settings in your init file will only affect the terminal which is active at the time the init file was evaluated.
The following Q+A deals with much the same issue, and goes into the details:
Run command on new frame with daemon/client in Emacs
For your issue, I think this should do the trick:
(defun my-terminal-config (&optional frame)
"Establish settings for the current terminal."
(if (not frame) ;; The initial call.
(xterm-mouse-mode 1)
;; Otherwise called via after-make-frame-functions.
(if xterm-mouse-mode
;; Re-initialise the mode in case of a new terminal.
(xterm-mouse-mode 1))))
;; Evaluate both now (for non-daemon emacs) and upon frame creation
;; (for new terminals via emacsclient).
(my-terminal-config)
(add-hook 'after-make-frame-functions 'my-terminal-config)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With