From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: `save-excursion' defeated by `set-buffer' Date: Sat, 09 Jan 2010 23:57:08 -0500 Message-ID: References: <87aaxdqwqv.fsf@regnitz.physics.niu.edu> <876380nvnt.fsf@lola.goethe.zz> <87hbrijbyg.fsf@lola.goethe.zz> <87skb0iw04.fsf@lola.goethe.zz> <1DA372296B5F41A1A3317F557D27355D@us.oracle.com> <87ocl8gvcn.fsf@lola.goethe.zz> <558DC61A9B3E4FF89CC53FF9DF7F7709@us.oracle.com> <87eim3hd14.fsf@lola.goethe.zz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1263099450 14585 80.91.229.12 (10 Jan 2010 04:57:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Jan 2010 04:57:30 +0000 (UTC) Cc: 'David Kastrup' , emacs-devel@gnu.org To: "Drew Adams" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 10 05:57:23 2010 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.50) id 1NTprc-00062A-T6 for ged-emacs-devel@m.gmane.org; Sun, 10 Jan 2010 05:57:21 +0100 Original-Received: from localhost ([127.0.0.1]:49261 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NTprd-0001bz-CV for ged-emacs-devel@m.gmane.org; Sat, 09 Jan 2010 23:57:21 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NTprX-0001bc-LB for emacs-devel@gnu.org; Sat, 09 Jan 2010 23:57:15 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NTprT-0001Wx-60 for emacs-devel@gnu.org; Sat, 09 Jan 2010 23:57:15 -0500 Original-Received: from [199.232.76.173] (port=48830 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NTprT-0001Wk-2X for emacs-devel@gnu.org; Sat, 09 Jan 2010 23:57:11 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:59427 helo=ironport2-out.pppoe.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NTprR-0003Cj-7k; Sat, 09 Jan 2010 23:57:09 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArgEACftSEvO+KPG/2dsb2JhbACBRNFEhC8Eiik X-IronPort-AV: E=Sophos;i="4.49,249,1262581200"; d="scan'208";a="53455175" Original-Received: from 206-248-163-198.dsl.teksavvy.com (HELO pastel.home) ([206.248.163.198]) by ironport2-out.pppoe.ca with ESMTP; 09 Jan 2010 23:57:08 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 82B2781C9; Sat, 9 Jan 2010 23:57:08 -0500 (EST) In-Reply-To: (Drew Adams's message of "Wed, 6 Jan 2010 00:57:27 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:119774 Archived-At: > which to code things, just what is inherently wrong or dangerous (meriting a > warning) with code like the following, to do some work in other buffers yet > return to the original buffer AND restore its point and mark? > (save-excursion > (set-buffer FOO) > ; Pick up some info in FOO, & perhaps assign it to a var > (set-buffer BAR) > ; Calculate something in BAR, & perhaps record it too > ... > ) What is dangerous about it is that dependong on which buffer is current before executing this code, the point-saving will either do something or nothing. That's a very delicate semantics, which (as mentioned) I've never found to be correct (i.e. the only times it works reliably is when the point-saving part of save-excursion is never useful nor harmful). Anyway, we just disagree, Stefan