[Top][All Lists]

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

save-excursion again

From: Uday S Reddy
Subject: save-excursion again
Date: Fri, 18 Jun 2010 08:42:31 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20100317 Thunderbird/3.0.4

I am just catching up belatedly with this issue of save-excursion getting defeated by set-buffer. Here is my understanding. Please let me know if I am missing anything. If I have a piece of code like this that runs in a buffer A:

        (set-buffer B)


- if the code X has no possibility of getting back to the buffer A and moving point, then save-excursion can be replaced by save-current-buffer (and the byte compiler gives you a brownie point).

- if the code X has a possibility of getting back to the buffer A and moving around, then save-excursion should stay (despite getting smacked by the byte compiler).

So, every time we want to please the byte compiler, we need to prove a little theorem to the effect that the code X doesn't enter the buffer A? (No doubt some of these theorems will be obvious.)


reply via email to

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