Go to the previous, next section.

Template for a  save-excursion Expression

The template for code using  save-excursion is simple:


The body of the function is one or more expressions that will be evaluated in sequence by the Lisp interpreter. If there is more than one expression in the body, the value of the last one will be returned as the value of the  save-excursion function. The other expressions in the body are evaluated only for their side effects; and  save-excursion itself is used only for its side effect (which is restoring the positions of point and mark).

In more detail, the template for a  save-excursion expression looks like this:


An expression, of course, may be a symbol on its own or a list.

In Emacs Lisp code, a  save-excursion expression often occurs within the body of a  let expression. It looks like this:

(let varlist

Go to the previous, next section.