Go to the first, previous, next, last section, table of contents.


Movement Functions

This section documents the functions which are used to create and modify position objects so that they point to a different position which is related to the original position in some way.

The functions which begin goto- set the cursor position of the current window to the new position; the others do not move the cursor, they simply calculate the new position and return it.

In some cases the position argument itself will be modified and returned, this may cause confusion; if there are existing references to the object they subtle bugs may result. Consider the following,

(setq x (cursor-pos)
      y (next-char 1 x))

At first glance this looks as though the variable y will point to one character after the variable x does. Since the next-char function modifies its argument position both variables will contain the same object, and therefore, point to the same position.

A solution is,

(setq x (cursor-pos)
      y (next-char 1 (copy-pos x)))

Read each function's description carefully to see if it alters its arguments!


Go to the first, previous, next, last section, table of contents.