Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacsclient does not respond to mouse clicks

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?

like image 931
hekevintran Avatar asked Jun 24 '11 00:06

hekevintran


1 Answers

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)
like image 67
phils Avatar answered Nov 15 '22 05:11

phils