From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: `save-excursion' defeated by `set-buffer' Date: Thu, 10 Mar 2011 20:28:07 -0500 Message-ID: References: <4D792D16.1080900@easy-emacs.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1299806918 31082 80.91.229.12 (11 Mar 2011 01:28:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 11 Mar 2011 01:28:38 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Andreas =?iso-8859-1?Q?R=F6hler?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 11 02:28:34 2011 Return-path: Envelope-to: geh-help-gnu-emacs@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 1Pxr9d-0004Aa-Ia for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Mar 2011 02:28:33 +0100 Original-Received: from localhost ([127.0.0.1]:32826 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pxr9d-0002qL-22 for geh-help-gnu-emacs@m.gmane.org; Thu, 10 Mar 2011 20:28:33 -0500 Original-Received: from [140.186.70.92] (port=48018 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pxr9G-0002qD-Re for help-gnu-emacs@gnu.org; Thu, 10 Mar 2011 20:28:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pxr9F-0003jB-H1 for help-gnu-emacs@gnu.org; Thu, 10 Mar 2011 20:28:10 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:40828 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pxr9F-0003j5-CA for help-gnu-emacs@gnu.org; Thu, 10 Mar 2011 20:28:09 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAD0JeU3O+IG+/2dsb2JhbACmNHjBT4ViBIUkkAk X-IronPort-AV: E=Sophos;i="4.62,299,1297054800"; d="scan'208";a="95606747" Original-Received: from 206-248-129-190.dsl.teksavvy.com (HELO ceviche.home) ([206.248.129.190]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 10 Mar 2011 20:28:08 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id 01BDD66135; Thu, 10 Mar 2011 20:28:07 -0500 (EST) In-Reply-To: <4D792D16.1080900@easy-emacs.de> ("Andreas =?iso-8859-1?Q?R?= =?iso-8859-1?Q?=F6hler=22's?= message of "Thu, 10 Mar 2011 20:57:10 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.183 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:79954 Archived-At: >> The difference between save-excursion and save-current-buffer is that >> the first doesn't just save&restore the current buffer but also "point& >> mark". But if you do `set-buffer' right after save-excursion then most >> likely you will change neither point nor mark in the original buffer, so >> the extra work performed by save-excursion compared to >> save-current-buffer will be useless. >> Now that's just a waste of resources but is otherwise harmless. >> >> Unless of course `blub' is already the current buffer to start with. >> >> I.e. whether point movement in "..." is undone by save-excursion will >> depend dynamically upon whether the current buffer happens to be `blub', >> which leads to subtle bugs. Hence the warning. > Thanks, this warning goes away if body is wrapped with a let: > (save-excursion > (let () > (set-buffer blub) > ... > )) I see you apparently didn't understand much of what I wrote :-( Stefan