Next: , Previous: Cut and Paste, Up: Frames

25.2 Following References with the Mouse

Some Emacs buffers include buttons. A button is a piece of text that performs some action when you activate it, such as following a reference. Usually, a button's text is visually highlighted: it is underlined, or a box is drawn around it. If you move the mouse over a button, the shape of the mouse cursor changes and the button lights up (if you change the variable mouse-highlight to nil, Emacs disables this highlighting).

You can activate a button by moving point to it and typing <RET>, or by clicking either Mouse-1 or Mouse-2 on the button. For example, typing <RET> or clicking on a file name in a Dired buffer visits that file (see Dired). Doing it on an error message in the ‘*Compilation*’ buffer goes to the source code for that error message (see Compilation). Doing it on a completion in the ‘*Completions*’ buffer chooses that completion (see Completion).

Although clicking Mouse-1 on a button usually activates that button, if you hold the mouse button down for a short period of time before releasing it (specifically, for more than 450 milliseconds), then Emacs moves point where you clicked instead. This behavior allows you to use the mouse to move point over a button without following it. Dragging—moving the mouse while it is held down—has its usual behavior of setting the region, even if you drag from or onto a button.

Normally, clicking Mouse-1 on a button activates the button even if it is in a nonselected window. If you change the variable mouse-1-click-in-non-selected-windows to nil, clicking Mouse-1 on a button in an un-selected window moves point to the clicked position and selects that window, without activating the button.

In Emacs versions before 22, only Mouse-2 activates buttons and Mouse-1 always sets point. If you prefer this older 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.