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 (
Activate a rectangular region around the text selected by dragging. See Rectangles.
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
selected window. You can also activate a region by double-clicking
mouse-1 (see Mouse Commands for Words and Lines).
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
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 The Mark and the Region).
In addition, the text in the region becomes the primary selection
(see Cut and Paste with Other Window Applications).
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 this variable is
non-empty, only copy to the kill ring if
the region is non-empty. For instance, if you mouse drag an area that
is less than a half a character, you’d normally get the empty string
in your kill ring, but with
non-empty, this short mouse drag
won’t affect the kill ring.
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.
If you enable the option
dragging files is supported by the window system, then dragging the
mouse on the buffer name portion of the mode line will drag that
buffer’s file to another program or frame.
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 Cut and Paste with Other Window Applications.
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-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. This mode also
supports increasing or decreasing the font size, by default bound to
scrolling with the Ctrl modifier. When this mode is enabled,
mouse wheel produces special events like
wheel-down. (Some older systems report them as
mouse-5.) If the mouse has a horizontal scroll wheel, it
wheel-right events as well.
Emacs also supports horizontal scrolling with the Shift
modifier. Typing a numeric prefix arg (e.g., M-5) before
starting horizontal scrolling changes its step value defined
by the user option
If your mouse’s wheel can be tilted, or if your touchpad supports it,
then you can also enable horizontal scrolling by customizing the
mouse-wheel-tilt-scroll to a non-
By default, tilting the mouse wheel scrolls the window’s view
horizontally in the direction of the tilt: e.g., tilting to the right
scrolls the window to the right, so that the text displayed in the
window moves horizontally to the left. If you’d like to reverse the
direction of horizontal scrolling, customize the variable
mouse-wheel-flip-direction to a non-
When the mouse pointer is over an image in Image mode, see Viewing Image Files, scrolling the mouse wheel with the Ctrl modifier scales the image under the mouse pointer, and scrolling the mouse wheel with the Shift modifier scrolls the image horizontally.