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: rusi
Subject: Re: `save-excursion' defeated by `set-buffer'
Date: Tue, 15 Mar 2011 21:31:32 -0700 (PDT)
User-agent: G2/1.0

On Mar 16, 12:02 am, Jason Earl <address@hidden> wrote:
> On Tue, Mar 15 2011, Stefan Monnier wrote:
> >> People will not naturally use `save-excursion' nowadays just to save
> >> the current buffer.
>
> > Maybe not naturally, no.  But thanks to the pressure of years of old
> > code flying around the web, they will do it nowadays on a regular
> > basis.  But indeed, thanks to threads like this one and to the warning
> > I added, I hope I can reverse the trend.
>
> >         Stefan
>
> Precisely, these warnings are not for people like you, Drew, or David.
> You guys have the experience necessary to make the correct choice.
> Warnings like this are *very* helpful to people like me, however, that
> have no experience with Emacs Lisp, but would like to write Elisp
> anyhow.
>
> To be honest, for the purpose of teaching newbies it almost doesn't
> matter what the warning says either.  As long as it is clear that
> save-excursion and set-buffer are not to be used together then it is a
> win.
>
> And yes, I realize that what I should do is read the manual umpteen
> million times, and memorize a pile of stuff.  Actually, in this case
> this might not be such a good idea.  I assumed that I had picked up the
> save-excursion + set-buffer idiom while I was perusing the Gnus code,
> but in checking the manual I think that I might have picked it up from
> the /Introduction to Emacs Lisp/.  Using save-excursion and set-buffer
> together is covered in:
>
>          4.4.3 `save-excursion' in `append-to-buffer'

Aha so that's the culprit
 (info "(eintr)append save-excursion")

A 30 year old project has 30 years of tradition, 30 years of of
stability...
And 30 years of cruft.
Anyone for a heavy-duty coarse-grade scrub?

Thanks Jason


reply via email to

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