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: Drew Adams
Subject: RE: `save-excursion' defeated by `set-buffer'
Date: Tue, 15 Mar 2011 11:55:57 -0700

> > Even if that were true for some very old code, there is no 
> > reason to bring `set-buffer' into it.
> 
> Of course there is: what I wrote is only true when set-buffer is used.
> When it's not used in the save-excursion, then it's actually very
> common for that save-excursion to indeed be used to save point

"when it's not used in the save-excursion" is not the same thing as "when I
don't see it in the `save-excursion' sexp.

As I said:

> > And even for such a search-and-destroy old code mission,
> > looking for `set-buffer' is by no means sufficient, as I'm sure
> > you realize.  You might as well just look for `save-excursion'
> > and check to see if each occurrence really needs to save point.
> > 
> > `set-buffer' is a red herring here - totally.  It is neither
> > necessary nor sufficient as an indicator of any problem.  It
> > does not matter what happens during a `save-excursion' excursion
> > - it really doesn't.  `set-buffer', `jump-off-the-deep-end',
> > `go-fly-a-kite', or whatever.  It just does not matter.

Even if you are worried about `set-buffer' (which you need not be), you won't
necessarily find it just by looking for it literally and lexically in the
`save-excursion' sexp.  But you know this.




reply via email to

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