GNU Info

Info Node: (emacs-lisp-intro.info)Template for save-excursion

(emacs-lisp-intro.info)Template for save-excursion


Prev: Point and mark Up: save-excursion
Enter node , (file) or (file)node

Template for a `save-excursion' Expression
------------------------------------------

   The template for code using `save-excursion' is simple:

     (save-excursion
       BODY...)

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:

     (save-excursion
       FIRST-EXPRESSION-IN-BODY
       SECOND-EXPRESSION-IN-BODY
       THIRD-EXPRESSION-IN-BODY
        ...
       LAST-EXPRESSION-IN-BODY)

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
       (save-excursion
         BODY...))


automatically generated by info2www version 1.2.2.9