So I'm reading through the Emacs Lisp intro, and I come across this function used as an example for save-excursion
:
(message "We are %d characters into this buffer."
(- (point)
(save-excursion
(goto-char (point-min)) (point))))
This doesn't seem to make any sense in terms of why the save-excursion
is there, what's the difference between that and this variation?
(message "We are %d characters into this buffer."
(point))
To me, it seems like all that
(save-excursion
(goto-char (point-min)) (point))
does is go to the beginning of the buffer and then call the point
function...which will return zero. so then what we're effectively doing is subtracting the point
called outside the save-excursion
by 0. Is there some hidden functionality that I'm not catching or was that just put there for the sake of showing how save-excursion
works?