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: Davis Herring
Subject: Re: `save-excursion' defeated by `set-buffer'
Date: Mon, 4 Jan 2010 09:08:53 -0800 (PST)
User-agent: SquirrelMail/1.4.8-5.7.lanl7

> save-excursion only saves point in the current buffer, so
>
>    (save-excursion (set-buffer foo) (goto-char (point-min)))
>
> will move point in foo and the point-saving done by save-excursion is
> useless.  So either you want to use

If we know that (eq foo (current-buffer)), we should drop the
`set-buffer'.  If we know that not to be the case, we should use
`with-current-buffer' (or perhaps `save-current-buffer').  But what if it
could but needn't be?

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




reply via email to

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