|
From: | Uday S Reddy |
Subject: | Re: save-excursion again |
Date: | Sat, 26 Jun 2010 12:03:38 +0100 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5 |
On 6/25/2010 10:20 PM, Stefan Monnier wrote:
Which brings up a question for Stefan. Are you saying that the condition-case-save-point-and-mark aspect of `save-excursion' should be abstracted out (say as `save-region') and separated from the save-buffer aspect?Not sure what you mean. If you mean we should introduce a save-excursion-but-not-buffer, then I think it's a bad idea, because such a thing would still have to save a marker (so there's no improvement in terms of the amount of data saved) and the semantics of "restore point in another buffer" is murky in Emacs.
I think the point is that save-excursion has been saving too much. So, when we see a save-excursion in a piece of code, we are not sure whether it was meant to save the point and mark, or the current-buffer, or both. It seems that the original developers were themselves unsure after a while.
I took Stephen's point as saying that, if we have separate save-current-buffer and save-region, with save-excursion strongly discouraged, we would promote a clearer programming style.
Cheers, Uday
[Prev in Thread] | Current Thread | [Next in Thread] |