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: Tue, 05 Jan 2010 23:20:59 -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> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1262751679 15549 80.91.229.12 (6 Jan 2010 04:21:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 6 Jan 2010 04:21:19 +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 Wed Jan 06 05:21:12 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 1NSNOR-0007XY-UH for ged-emacs-devel@m.gmane.org; Wed, 06 Jan 2010 05:21:12 +0100 Original-Received: from localhost ([127.0.0.1]:59145 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSNOS-0001m2-EJ for ged-emacs-devel@m.gmane.org; Tue, 05 Jan 2010 23:21:12 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NSNON-0001lZ-DF for emacs-devel@gnu.org; Tue, 05 Jan 2010 23:21:07 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NSNOJ-0001kp-Mc for emacs-devel@gnu.org; Tue, 05 Jan 2010 23:21:07 -0500 Original-Received: from [199.232.76.173] (port=38769 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSNOJ-0001km-GV for emacs-devel@gnu.org; Tue, 05 Jan 2010 23:21:03 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:34912 helo=ironport2-out.pppoe.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NSNOH-00020s-Ms; Tue, 05 Jan 2010 23:21:01 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlQGALaeQ0vO+KPG/2dsb2JhbACBRdIthDAEiik X-IronPort-AV: E=Sophos;i="4.49,226,1262581200"; d="scan'208";a="53105358" Original-Received: from 206-248-163-198.dsl.teksavvy.com (HELO ceviche.home) ([206.248.163.198]) by ironport2-out.pppoe.ca with ESMTP; 05 Jan 2010 23:21:00 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id EDC84B4077; Tue, 5 Jan 2010 23:20:59 -0500 (EST) In-Reply-To: <558DC61A9B3E4FF89CC53FF9DF7F7709@us.oracle.com> (Drew Adams's message of "Tue, 5 Jan 2010 16:02:39 -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:119500 Archived-At: > Certainly, `set-buffer' does not undo or inhibit or interfere with the > normal behavior of `save-excursion'; it cannot be said to "defeat" > `save-excursion' in any way. The experience so far is that when replacing (save-excursion (set-buffer FOO) ...) with (with-current-buffer FOO ...) either the behavior is unchanged (i.e. the set-buffer makes the point-saving part of save-excursion useless), or a bug shows up which can be fixed with the use of (with-current-buffer FOO (save-excursion ...)) I.e. the original code only worked right when the set-buffer was a noop (which for such code is typically the most common case, obviously, otherwise the bug would have surfaced earlier). > IMO the warning should simply be removed. Show me a single case (in existing code) where (save-excursion (set-buffer FOO) ...) wouldn't better be written some other way. Stefan