Skip to main content

6.1 Using Emacs on Touchscreens

Touchscreen input is the manipulation of a frame's contents by the placement and motion of tools (instanced by fingers and such pointing devices as styluses) on a monitor or computer terminal where it is displayed.

Two factors, the order and position on which such tools are placed, are compared against predefined patterns dubbed gestures, after which any gesture those factors align with designates a series of actions to be taken on the text beneath the tools; the gestures presently recognized are:

  • Tapping, briefly placing and lifting a tool from the display, will select the window that was tapped, and execute any command bound to mouse-1 at that location in the window. If a link (see Following References with the Mouse) exists there, then Emacs will follow that link instead (insofar as such action differs from that taken upon the simulation of a mouse-1 event).

  • Scrolling, which is continuous vertical or horizontal motion on the screen, will scroll the contents of the window beneath the tool's initial location in the direction of movement. The user option touch-screen-enable-hscroll governs whether horizontal scrolling (see Horizontal Scrolling) is performed in reaction to this gesture.

  • Dragging, which is performing a long-press by placing a tool on the display and leaving it there awhile before moving it to another position, will move point to the tool's initial position, and commence selecting text under the tool as it continues its motion, as if mouse-1 were to be held down and a mouse moved analogously. See Mouse Commands for Editing.

    To the detriment of text selection, it can prove challenging to position a tool accurately on a touch screen display. The user option touch-screen-word-select, which when enabled, prompts dragging to select the complete word under the tool. (Normally, the selection is only extended to encompass the character beneath the tool.)

    In the same vein, it may be difficult to select all of the text intended within a single gesture. If the user option touch-screen-extend-selection is enabled, taps on the locations of the point or the mark within a window will begin a new "drag" gesture, where the region will be extended in the direction of any subsequent movement.

    Difficulties in making accurate adjustments to the region from the cursor being physically obscured by the tool can be mitigated by indicating the position of the point within the echo area. If touch-screen-preview-select is non-nil, the line surrounding point is displayed in the echo area (see The Echo Area) during the motion of the tool, below which is another line indicating the position of point relative to the first.

  • Pinching, the placement of two tools apart on the screen followed by adjustments to their position such as to increase or decrease the distance between them will modify the text scale (see Text Scale) in proportion to the change in that distance.

Emacs registers a long-press after the time a tool has been placed upon the screen exceeds 0.7 seconds. This delay can be adjusted through customizing the variable touch-screen-delay.