Elisp: Text Editing Functions
Here's the most used functions related to text editing.
;; insert string at current cursor position (insert "sun and moon")
(info "(elisp) Text")
delete-char → delete n characters to the right. Argument can be negative, to delete to the left.
;; delete 9 chars starting at cursor pos (delete-char 9)
delete-region → delete text btween 2 positions.
;; deleting text btween positions 59 and 896 (delete-region 59 896)
erase-buffer → delete all next in buffer, ignores
delete-and-extract-region → Delete between 2 positions and return the deleted text.
(delete-and-extract-region 3 20)