Move point to where you click (
Activate the region around the text selected by dragging, and put the
text in the primary selection (
Move point to where you click, and insert the contents of the primary
selection there (
If the region is active, move the nearer end of the region to the
click position; otherwise, set mark at the current value of point and
point at the click position. Save the resulting region in the kill
ring; on a second click, kill it (
The most basic mouse command is
mouse-set-point, which is
invoked by clicking with the left mouse button, mouse-1, in the
text area of a window. This moves point to the position where you
clicked. If that window was not the selected window, it becomes the
Normally, if the frame you clicked in was not the selected frame, it is made the selected frame, in addition to selecting the window and setting the cursor. On the X Window System, you can change this by setting the variable x-mouse-click-focus-ignore-position to t. In that case, the initial click on an unselected frame just selects the frame, without doing anything else; clicking again selects the window and sets the cursor position.
Holding down mouse-1 and dragging the mouse over a stretch
of text activates the region around that text
mouse-set-region), placing the mark where you started holding
down the mouse button, and point where you release it (see Mark).
In addition, the text in the region becomes the primary selection
(see Primary Selection).
If you change the variable mouse-drag-copy-region to a
nil value, dragging the mouse over a stretch of text also
adds the text to the kill ring. The default is
If you move the mouse off the top or bottom of the window while dragging, the window scrolls at a steady rate until you move the mouse back into the window. This way, you can select regions that don’t fit entirely on the screen. The number of lines scrolled per step depends on how far away from the window edge the mouse has gone; the variable mouse-scroll-min-lines specifies a minimum step size.
Clicking with the middle mouse button, mouse-2, moves point to
the position where you clicked and inserts the contents of the primary
mouse-yank-primary). See Primary Selection.
This behavior is consistent with other X applications. Alternatively,
you can rebind mouse-2 to
performs a yank at the position you click.
If you change the variable mouse-yank-at-point to a
nil value, mouse-2 does not move point; it inserts
the text at point, regardless of where you clicked or even which of
the frame’s windows you clicked on. This variable affects both
Clicking with the right mouse button, mouse-3, runs the
mouse-save-then-kill. This performs several actions
depending on where you click and the status of the region:
mouse-save-then-kill command also obeys the variable
mouse-drag-copy-region (described above). If the value is
nil, then whenever the command sets or adjusts the active
region, the text in the region is also added to the kill ring. If the
latest kill ring entry had been added the same way, that entry is
replaced rather than making a new entry.
Whenever you set the region using any of the mouse commands described above, the mark will be deactivated by any subsequent unshifted cursor motion command, in addition to the usual ways of deactivating the mark. See Shift Selection.
Some mice have a “wheel” which can be used for scrolling. Emacs supports scrolling windows with the mouse wheel, by default, on most graphical displays. To toggle this feature, use M-x mouse-wheel-mode. The variables mouse-wheel-follow-mouse and mouse-wheel-scroll-amount determine where and by how much buffers are scrolled. The variable mouse-wheel-progressive-speed determines whether the scroll speed is linked to how fast you move the wheel.