help-gnu-emacs
[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: Tue, 15 Mar 2011 13:42:40 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>> So the warning was introduced to help Elisp coders improve their code.
>> That's what byte-compiler warnings are for.

> It's hard to tell what's wrong with the code based on this warning,
> though.  (It says save-excursion is "defeated", but buffer, point, and
> mark still seem to be getting restored.  So what's the hidden danger?)
>  Maybe it should specifially say something like, "save-excursion +
> set-buffer could possibly be replaced by with-current-buffer."

Indeed, I've changed it yesterday (or so) in Emacs trunk to drop the
"defeat" verbiage and just recommend to replace it with
with-current-buffer, based on Uday's earlier suggestion.


        Stefan


reply via email to

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