From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: `save-excursion' defeated by `set-buffer' Date: Tue, 05 Jan 2010 21:17:12 +0100 Organization: Organization?!? Message-ID: <87ocl8gvcn.fsf@lola.goethe.zz> 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> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1262733736 8386 80.91.229.12 (5 Jan 2010 23:22:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Jan 2010 23:22:16 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 06 00:22:10 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 1NSIj3-0003pD-1Y for ged-emacs-devel@m.gmane.org; Wed, 06 Jan 2010 00:22:09 +0100 Original-Received: from localhost ([127.0.0.1]:37440 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSIj3-0001iu-HP for ged-emacs-devel@m.gmane.org; Tue, 05 Jan 2010 18:22:09 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NSFqc-0002y3-Tv for emacs-devel@gnu.org; Tue, 05 Jan 2010 15:17:47 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NSFqY-0002wh-F8 for emacs-devel@gnu.org; Tue, 05 Jan 2010 15:17:46 -0500 Original-Received: from [199.232.76.173] (port=58315 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSFqY-0002we-5r for emacs-devel@gnu.org; Tue, 05 Jan 2010 15:17:42 -0500 Original-Received: from mx20.gnu.org ([199.232.41.8]:37344) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NSFqX-0005iV-TN for emacs-devel@gnu.org; Tue, 05 Jan 2010 15:17:42 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NSFqW-00013Y-Aq for emacs-devel@gnu.org; Tue, 05 Jan 2010 15:17:41 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.50) id 1NSFqR-0003qS-VU for emacs-devel@gnu.org; Tue, 05 Jan 2010 21:17:35 +0100 Original-Received: from p5b2c22e0.dip.t-dialin.net ([91.44.34.224]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Jan 2010 21:17:35 +0100 Original-Received: from dak by p5b2c22e0.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Jan 2010 21:17:35 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 44 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: p5b2c22e0.dip.t-dialin.net X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux) Cancel-Lock: sha1:b14eXbHqf5iZW8Blq8fcKxVLv2I= X-detected-operating-system: by mx20.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:119470 Archived-At: Stefan Monnier writes: >> I would like to see a clear, logical presentation of what your position is, >> Stefan. It's not obvious to me what this is all about. > > It's really not about much. Feel free to completely ignore it. > I've updated the manual (except for the lisp-intro) to eliminate the > more obvious problems. > >> The explanation in that node is just what I've always understood wrt >> `save-excursion'. It makes it clear that only point and mark of the >> current buffer are saved and restored, along with the identity of the >> current buffer. So I really don't see what the problem is. > > The propblem is that even tho it's clear, people tend to forget about > it. Proof is the dired-mouse-find-file-other-window example code in the > manual which did > > (save-excursion > ... > (set-buffer ...) > (goto-char ...) > ...) > > The problem with that code is that point in current buffer will be moved > depending on whether the buffer we switch to is the same as the > current buffer. And it will get restored in the current (original) buffer at the end of the save-excursion. So it is not the save-excursion that is defeated by set-buffer, but rather the goto-char which may be defeated by save-excursion. > That's unlikely to be what the author intended. She probably either > didn't want to save point (and juse use save-current-buffer instead), > or did want to save point (in which case she needed > save-current-buffer around and an additional save-excursion inside). Or she wanted to have point and buffer restored at the end of the save-excursion. -- David Kastrup