Useful Built-In Emacs Functions

Many of the Emacs functions that exist and that you may write involve searching and manipulating the text in a buffer. Such functions are particularly useful in specialized modes, like RMAIL and the programming language modes described in the previous chapter. There are many built-in Emacs functions that relate to text in strings and buffers; the most interesting ones take advantage of Emacs’ regular expression facility, which we introduced in Chapter 3.

We will first describe the basic functions relating to buffers and strings that don’t use regular expressions. Afterwards, we will discuss regular expressions in more depth than was the case in Chapter 3, concentrating on the features that are most useful to LISP programmers, and we will describe the functions that Emacs makes available for dealing with regular expressions.

Buffers, Text, and Regions

Table 13-4 shows some basic Emacs functions relating to buffers, text, and strings that are only useful to LISP programmers and thus aren’t bound to keystrokes. We already saw a couple of them in the count-words-buffer example.

Table 14-4. Buffer and Text Functions

Function

Value or Action

point

Character position of point

mark

Character position of mark

point-min

Minimum character position (usually 1)

point-max

Maximum character position (usually size of buffer)

bolp

Whether point is at the beginning of the line (t/nil)

eolp

Whether point is at the end of the line

bobp ...

Get Learning GNU Emacs, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.