I'm doing the ELISP - Tutorial right now and am unsure about the meaning of "restore" in the standard elisp function save-excursion (or equally save-current-buffer). It's probably just cause I'm no native English speaker and dont get how strong or weak "restore" is.
Let's say current buffer is A and i do in save-excursion enviroment a operation in which A is altered, for example a string inserted, I'd expect save excursion to restore A, so undo the changes in that operation.
The actual problem I don't understand is the example from copy-to-buffer:
(defun copy-to-buffer (buffer start end)
(interactive "BCopy to buffer: \nr")
(let ((oldbuf (current-buffer)))
(with-current-buffer (get-buffer-create buffer)
(barf-if-buffer-read-only)
(erase-buffer)
(save-excursion
(insert-buffer-substring oldbuf start end)))))
The last save-excursion works in the frame of with-current-buffer, which made the buffer given by the user current and inserts a string there. If it restores the buffer it would undo the insertion. Obviously it does not, but what does "restore the buffer" then mean ?
save-excursionis fairly explicit (Ctrl-h f save-excursion): "Save point, mark, and current buffer; execute BODY; restore those things." - tripleee