Next: , Previous: Clipboard, Up: Frames


26.4 Following References with the Mouse

Some read-only Emacs buffers include references you can follow, or commands you can activate. These include names of files, of buffers, of possible completions, of matches for a pattern, as well as the buttons in Help buffers and customization buffers. You can follow the reference or activate the command by moving point to it and typing <RET>. You can also do this with the mouse, using either Mouse-1 or Mouse-2.

Since yanking text into a read-only buffer is not allowed, these buffers generally define Mouse-2 to follow a reference or activate a command. For example, if you click Mouse-2 on a file name in a Dired buffer, you visit that file. If you click Mouse-2 on an error message in the ‘*Compilation*’ buffer, you go to the source code for that error message. If you click Mouse-2 on a completion in the ‘*Completions*’ buffer, you choose that completion.

However, most applications use Mouse-1 to do this sort of thing, so Emacs implements this too. If you click Mouse-1 quickly on a reference or button, it follows or activates. If you click slowly, it moves point as usual. Dragging, meaning moving the mouse while it is held down, also has its usual behavior of setting the region.

Normally, the Mouse-1 click behavior is performed on links in any window. The variable mouse-1-click-in-non-selected-windows controls whether Mouse-1 has this behavior even in non-selected windows, or only in the selected window.

You can usually tell when Mouse-1 and Mouse-2 have this special sort of meaning because the sensitive text highlights when you move the mouse over it. The variable mouse-highlight controls whether to do this highlighting always (even when such text appears where the mouse already is), never, or only immediately after you move the mouse.

In Emacs versions before 22, only Mouse-2 follows links and Mouse-1 always sets points. If you prefer this behavior, set the variable mouse-1-click-follows-link to nil. This variable also lets you choose various other alternatives for following links with the mouse. Type C-h v mouse-1-click-follows-link <RET> for more details.