Emacs Advent Calendar 13: Mouse Commands

Sun 2015-12-13

Although all Emacs functionality can be accessed using only the keyboard, the graphical version also features mouse commands.

First a note on terminology: as usual, Mouse-1 denotes the left mouse button, Mouse-2 is the middle mouse button and Mouse-3 the right mouse button.

Although obvious, let's mention for consistency's sake that a click of Mouse-1 on the buffer moves point to the position of the click. Intuitively Drag-Mouse-1 activates and sets the region around the text selected by dragging and puts it into primary selection so it can be pasted by clicking Mouse-2 in Emacs or other X applications.

A concept usually not found outside emacs is the ability to change the boundaries of an active region with a click of Mouse-3: it moves the nearer end of the region to the position clicked. If no region is active, it activates a region spanning from point to the click position. A second click of Mouse-3 in the same position kills the region.

To select one word, use Double-Mouse-1. To select text by whole words, use Double-Drag-Mouse-1. A Triple-Mouse-1 click selects the line, similarly Triple-Drag-Mouse-1 selects text by lines.

Combinations of mouse clicks and modifier buttons bring up menus. C-Mouse-1 pops up a menu for buffer selection. C-Mouse-3 opens a mode-specific menu, usually with the contents of all the mode-specific menu-bar menus. S-Mouse-1 contains functions to change the buffer font or the size of it.

Clicking on the mode line has different effects. Mouse-1 selects the mode-line's window, dragging changes its size. Mouse-2 makes the window fill the whole frame (like C-x 1 does), Mouse-3 deletes the window (like C-x 0). Other entries of the mode-line show available mouse click commands in a tooltip when hovering the pointer over them.

Finally, clicking C-Mouse-2 on the mode line splits a window into two windows side by side. Depending on Emacs' compilation options, clicking C-Mouse-2 on the scroll bar creates a horizontal split.

More information on this can be found in sections 21.1 (Mouse Commands for Editing), 21.2 (Mouse Commands for Words and Lines), 21.4 (Mouse Clicks for Menus), 21.5 (Mode Line Mouse Commands) and 20.2 (Splitting Windows).

Tags:

This text by Ludger Sandig is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.