emacs-devel
[Top][All Lists]
Advanced

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

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


From: Stefan Monnier
Subject: Re: `save-excursion' defeated by `set-buffer'
Date: Wed, 23 Dec 2009 23:35:42 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux)

>> Irrelevant: neither example uses (save-excursion (set-buffer ..) ...).
> Don't be disingenuous.  with-temp-buffer uses with-current-buffer, which
> is basically (save-current-buffer (set-buffer ...

save-current-buffer != save-excursion

This warning is specificaly aimed at reminding people that the two are
different, so you clearly need to see this warning a few more times
before you start to understand what it's about.

>> Obviously "if you didn't want to move point in foo" implies that you did
>> not want "to have mark, point, and buffer restored".

> I don't see the obviousness.

The code I show *does* move point within the save-excursion, so by
"didn't move point" I meant the same as your "restore point".
Hence the "obviousness".

> And even _if_ using save-excursion for saving _both_ buffer and its
> point was deprecated (for which I see no good reason whatsoever): as
> long as the DOC string of save-excursion does not even _mention_
> save-current-buffer, it is not appropriate to throw warnings at
> the user.

Fair enough, I've just added a note to the docstring.


        Stefan




reply via email to

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