Previous: , Up: Marks   [Contents][Index]


2.2.4 Moving Marks

These functions destructively modify marks to point to new positions. Other sections of this document describe mark moving routines specific to higher level text forms than characters and lines, such as words, sentences, paragraphs, Lisp forms, etc.

Function: move-to-position mark charpos &optional line

This function changes the mark to point to the given character position on the line line. Line defaults to mark’s line.

Function: move-mark mark new-position

This function moves mark to the same position as the mark new-position and returns it.

Function: line-start mark &optional line
Function: line-end mark &optional line

This function changes mark to point to the beginning or the end of line and returns it. Line defaults to mark’s line.

Function: buffer-start mark &optional buffer
Function: buffer-end mark &optional buffer

These functions change mark to point to the beginning or end of buffer, which defaults to the buffer mark currently points into. If buffer is unsupplied, then it is an error for mark to be disassociated from any buffer.

Function: mark-before mark
Function: mark-after mark

These functions change mark to point one character before or after the current position. If there is no character before/after the current position, then they return nil and leave mark unmodified.

Function: character-offset mark n

This function changes mark to point n characters after (n before if n is negative) the current position. If there are less than n characters after (before) the mark, then this returns nil and mark is unmodified.

Function: line-offset mark n &optional charpos

This function changes mark to point n lines after (n before if n is negative) the current position. The character position of the resulting mark is

(min (line-length resulting-line) (mark-charpos mark))

if charpos is unspecified, or

(min (line-length resulting-line) charpos)

if it is. As with character-offset, if there are not n lines then nil is returned and mark is not modified.


Previous: Making Marks, Up: Marks   [Contents][Index]