emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Behaviour for save-excursion


From: Nathaniel Flath
Subject: Behaviour for save-excursion
Date: Tue, 6 Oct 2009 09:44:38 -0400

What is the proper behaviour for save-excursion?  The emacs-lisp intro and the docstring seem to have slightly differing explanations - namely, the docstring mentions that it saves current-buffer as well as point and mark, and the emacs-lisp intro does not.  Based on just what it does, I'm not entirely sure which is correct - the following code snippet, executed in *scratch*, returns the "*scratch*" buffer but the buffer displayed is the "bar" buffer, and evaluating current-bufer afterwards returns the "bar" buffer. 

(progn
  (save-excursion
    (switch-to-buffer "bar"))
  (current-buffer))

Either the manual or the docstring should be changed to reflect what it does, but I'm not entirely sure which based on this.

Thanks,
Nathaniel Flath

reply via email to

[Prev in Thread] Current Thread [Next in Thread]