Elisp: Move Cursor
Move Cursor to a Position
goto-char-
(goto-char POSITION)Move cursor to a given position.
;; move cursor to position 392 (goto-char 392)
Move by Char Count, by Word
forward-char-
(forward-char &optional N)Move cursor forward by N characters.
see also
backward-char;; move cursor by 9 chars (forward-char 9)
forward-wordbackward-word
Move by Line
forward-linebeginning-of-lineend-of-line
Move Cursor by Skip Chars
skip-chars-forward-
(skip-chars-forward STRING &optional maxPos)- Move cursor forward by skipping chars in STRING.
- but do not go beyond maxPos
- Returns the distance traveled, either zero or positive.
STRING is like the inside of a
[chars]in a Regular Expression Syntax;; move cursor, by skipping whitespace (skip-chars-forward " \n\t") ;; mover cursor, by skipping alphanumeric and hyphen lowline (skip-chars-forward "-_a-zA-Z0-9") skip-chars-backward-
(skip-chars-backward STRING &optional LIM)similar to
skip-chars-forwardbut backward.;; move cursor backward, skip space tab newline (skip-chars-backward " \t\n") ;; skip a to z and hyphen (skip-chars-backward "-a-z")
Move Cursor by Search Text
These search functions are used for searchinng text and find replace, but they also move cursor and return cursor position.
- plain string
search-forwardsearch-backward
- regex
re-search-forwardre-search-backward
Reference
Elisp, text processing functions
- Elisp: Cursor Position Functions
- Elisp: Move Cursor
- Elisp: Text Editing Functions
- Elisp: Search Text
- Elisp: Find Replace Text in Buffer
- Elisp: Mark, Region, Active Region
- Elisp: Cut Copy Paste, kill-ring
- Elisp: Get Buffer String
- Elisp: Functions on Line
- Elisp: Get Text at Cursor (thing-at-point)
- Elisp: Get Text Block 📜
- Elisp: Save narrow-to-region