21.3 Following References with the Mouse
Some Emacs buffers include buttons, or hyperlinks:
pieces of text that perform some action (e.g., following a reference)
when activated (e.g., by clicking on them). 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, in a Dired buffer, each file name is a button;
activating it causes Emacs to visit that file (see Dired, the Directory Editor). In a
*Compilation*
buffer, each error message is a button, and
activating it visits the source code for that error
(see Running Compilations under Emacs).
Although clicking mouse-1
on a button usually activates the
button, if you hold the mouse button down for a period of time before
releasing it (specifically, for more than 450 milliseconds), then
Emacs moves point where you clicked, without activating the button.
In this way, you can use the mouse to move point over a button without
activating it. Dragging the mouse over or onto a button has its usual
behavior of setting the region, and does not activate the button.
You can change how mouse-1
applies to buttons by customizing
the variable mouse-1-click-follows-link
. If the value is a
positive integer, that determines how long you need to hold the mouse
button down for, in milliseconds, to cancel button activation; the
default is 450, as described in the previous paragraph. If the value
is nil
, mouse-1
just sets point where you clicked, and
does not activate buttons. If the value is double
, double
clicks activate buttons but single clicks just set point.
Normally, mouse-1
on a button activates the button even if it
is in a non-selected window. If you change the variable
mouse-1-click-in-non-selected-windows
to nil
,
mouse-1
on a button in an unselected window moves point to the
clicked position and selects that window, without activating the
button.