2

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?

1

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 ... – Gábor Angyal Sep 8 '16 at 7:20
  • It should be released real-soon-now. – Stefan Sep 8 '16 at 18:59
0

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)
      (push-button)
      (neotree-enter)))
(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. – Gilles Sep 7 '16 at 7:00
  • I do not experience any side effects. What are your considerations? – Gábor Angyal Sep 7 '16 at 11:00
0

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? – Gábor Angyal Sep 7 '16 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. – Gilles Sep 7 '16 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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