[Top][All Lists]

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

Re: `save-excursion' defeated by `set-buffer'

From: Harald Hanche-Olsen
Subject: Re: `save-excursion' defeated by `set-buffer'
Date: Sun, 10 Jan 2010 10:58:20 -0500 (EST)

+ Stefan Monnier <address@hidden>:

> [...]
>   (with-current-buffer FOO ...)
> [...]
>   (with-current-buffer FOO (save-excursion ...))

An aside: While reading this discussion I wanted to experiment to
understand the difference between the two forms above. If I execute
the following from a buffer other than *scratch*, the letter A is
inserted four places after point, but point does not move:

(with-current-buffer "*scratch*" (forward-char 4) (insert "A"))

However, the doc string for with-current-buffer says nothing about
restoring point. This is confusing. Also, with-current-buffer expands
to save-current-buffer, whose doc string also says nothing about
restoring point. Again confusing.

- Harald

reply via email to

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