PREV UP NEXT GNU Emacs Lisp Reference Manual



Chapter 29: Text

This chapter describes the functions that deal with the text in a buffer. Most examine, insert, or delete text in the current buffer, often in the vicinity of point. Many are interactive. All the functions that change the text provide for undoing the changes (see Undo).

Many text-related functions operate on a region of text defined by two buffer positions passed in arguments named start and end. These arguments should be either markers (see Markers) or numeric character positions (see Positions). The order of these arguments does not matter; it is all right for start to be the end of the region and end the beginning. For example, (delete-region 1 10) and (delete-region 10 1) are equivalent. An args-out-of-range error is signaled if either start or end is outside the accessible portion of the buffer. In an interactive call, point and the mark are used for these arguments.

Throughout this chapter, ``text'' refers to the characters in the buffer, together with their properties (when relevant).

  • Near Point Examining text in the vicinity of point.
  • Buffer Contents Examining text in a general fashion.
  • Comparing Text Comparing substrings of buffers.
  • Insertion Adding new text to a buffer.
  • Commands for Insertion User-level commands to insert text.
  • Deletion Removing text from a buffer.
  • User-Level Deletion User-level commands to delete text.
  • The Kill Ring Where removed text sometimes is saved for later use.
  • Undo Undoing changes to the text of a buffer.
  • Maintaining Undo How to enable and disable undo information. How to control how much information is kept.
  • Filling Functions for explicit filling.
  • Margins How to specify margins for filling commands.
  • Auto Filling How auto-fill mode is implemented to break lines.
  • Sorting Functions for sorting parts of the buffer.
  • Columns Computing horizontal positions, and using them.
  • Indentation Functions to insert or adjust indentation.
  • Case Changes Case conversion of parts of the buffer.
  • Text Properties Assigning Lisp property lists to text characters.
  • Substitution Replacing a given character wherever it appears.
  • Transposition Swapping two portions of a buffer.
  • Registers How registers are implemented. Accessing the text or position stored in a register.
  • Change Hooks Supplying functions to be run when text is changed.