From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Uday S Reddy Newsgroups: gmane.emacs.devel Subject: save-excursion again Date: Fri, 18 Jun 2010 08:42:31 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1276846980 21992 80.91.229.12 (18 Jun 2010 07:43:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 18 Jun 2010 07:43:00 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 18 09:42:59 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OPWE4-0004g7-DU for ged-emacs-devel@m.gmane.org; Fri, 18 Jun 2010 09:42:56 +0200 Original-Received: from localhost ([127.0.0.1]:52587 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPWE3-0006Xm-OR for ged-emacs-devel@m.gmane.org; Fri, 18 Jun 2010 03:42:55 -0400 Original-Received: from [140.186.70.92] (port=54189 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPWDx-0006Wg-E2 for emacs-devel@gnu.org; Fri, 18 Jun 2010 03:42:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OPWDw-0000TH-2T for emacs-devel@gnu.org; Fri, 18 Jun 2010 03:42:49 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:33753) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OPWDv-0000T6-Rf for emacs-devel@gnu.org; Fri, 18 Jun 2010 03:42:48 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OPWDu-0004dc-AA for emacs-devel@gnu.org; Fri, 18 Jun 2010 09:42:46 +0200 Original-Received: from cpc10-harb6-0-0-cust112.perr.cable.virginmedia.com ([92.232.137.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 18 Jun 2010 09:42:46 +0200 Original-Received: from u.s.reddy by cpc10-harb6-0-0-cust112.perr.cable.virginmedia.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 18 Jun 2010 09:42:46 +0200 X-Injected-Via-Gmane: http://gmane.org/ connect(): No such file or directory Original-Lines: 27 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cpc10-harb6-0-0-cust112.perr.cable.virginmedia.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:126131 Archived-At: 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: (save-excursion (set-buffer B) ....X.... ) then: - 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.) Cheers, Uday