I am using emacs with PuTTY. I have xterm-mouse-mode turned on, and it works nicely, except that nothing happens when I click on "clickable texts" for example on the start page, or in neotree.

Is there a way to use mouse clicks for these?


3 Answers 3


This was a bug in the xterm-mouse-mode handling. Should be fixed in Emacs-25.

If you're interested about the details, the problem is the need to perform several rewritings: - first from xterm's escape sequence to a mouse-1 event. - then from mouse-1 to mouse-2 (because it's a left click on a link).

These two steps only work if they're performed in the right order, but in the old code, the two steps were not performed in the right order, so when the link-handling code was trying to modify mouse-1 into mouse-2, all it saw was some escape sequence which it had no idea was actually "equivalent" to a mouse-1.

  • Is Emacs-25 stable yet? It does not seem to be accessible from the main ftp server ... Sep 8, 2016 at 7:20
  • It should be released real-soon-now.
    – Stefan
    Sep 8, 2016 at 18:59

As Gilles said, emacs interprets the clicks of the middle mouse button, not the left. This means that you should first move the cursor to the desired position with the left mouse button, and then click with the middle. I do not find this behavior ergonomic, so I redefined the left-click to the "usual" way:

(defun on-mouse1-click (*click)
    (interactive "e")
    (let ((p1 (posn-point (event-start *click))))
      (goto-char p1)
(global-set-key (kbd "<mouse-1>") 'on-mouse1-click)
  • That's going to be disruptive when you click outside of a button or in a buffer other than neotree. Sep 7, 2016 at 7:00
  • I do not experience any side effects. What are your considerations? Sep 7, 2016 at 11:00

On linked text, such as what you find on the start page, left-clicking only moves the cursor and sets the active window like it normally does. To follow the link, you need to press the middle mouse button (that's the wheel if you have a two-buttons-and-a-wheel mouse). Left-clicking does push proper buttons.

A a long press of the left mouse button (450ms by default) also follows links, but I think that doesn't work in terminals.

If you want left clicks to always follow links regardless of duration, in the Customize interface, go to Editing → Mouse and change the setting of “Mouse 1 Click Follows Link” to enable it. Or put this in your init file:

(setq mouse-1-click-follows-link t)

If you want only double-clicks of the left button to follow links, set the variable to double instead of t.

I don't know if that setting affects Neotree.

GUI Emacs tends to be more comfortable to work in than terminal Emacs. Instead of running Emacs on the remote machine, consider running Emacs locally and editing remote files.

  • The long press does not seem to work. Maybe because I am using PuTTY? Sep 7, 2016 at 7:32
  • @GáborAngyal Maybe. In fact it doesn't work in xterm either. This may have to do with the way terminals report mouse events. Sep 7, 2016 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.