From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: (save-excursion (other-window 1)) leaves me in the other window Date: Tue, 09 Mar 2010 17:45:38 +1100 Organization: Unlimited download news at news.astraweb.com Message-ID: <87iq96ro19.fsf@rapttech.com.au> References: <87y6i4sjsn.fsf@rapttech.com.au> <87mxyjs28x.fsf@rapttech.com.au> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1272991340 10038 80.91.229.12 (4 May 2010 16:42:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 4 May 2010 16:42:20 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 04 18:42:18 2010 connect(): No such file or directory 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 1O9LCL-0007cY-P5 for geh-help-gnu-emacs@m.gmane.org; Tue, 04 May 2010 18:42:18 +0200 Original-Received: from localhost ([127.0.0.1]:43386 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9LCK-0004QN-V1 for geh-help-gnu-emacs@m.gmane.org; Tue, 04 May 2010 12:42:16 -0400 Original-Path: usenet.stanford.edu!news.glorb.com!news2.glorb.com!news.glorb.com!news.astraweb.com!border1.newsrouter.astraweb.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.93 (gnu/linux) Cancel-Lock: sha1:Il5zMdPDG4b4C0bFmDJI/dp1io4= Original-Lines: 38 Original-NNTP-Posting-Host: bbe931c9.news.astraweb.com Original-X-Trace: DXC=4e=UG3[dIo0:>h5BA Original-Xref: usenet.stanford.edu gnu.emacs.help:177414 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:72941 Archived-At: Sean McAfee writes: > Tim X writes: >> Sean McAfee writes: >>> Although the documentation for save-excursion says that it saves and >>> restores the current buffer, it doesn't in this case. > >> Note that the docs as you noted say that they restore the buffer, not >> the window. This was part of the point I was tyring to make. Buffers and >> windows are not the same thing. > > If the current buffer is restored, then I would expect this expression: > > (eq (current-buffer) (save-excursion arbitrary-forms (current-buffer))) > > ...to always evaluate to t regardless of what arbitrary-forms is, but it > returns nil if I replace arbitrary-forms with (other-window 1). I suspect your assuption is incorrect. The documentation for save-excursion does not explicitly state what its return value is. However, it does say that @body is executed 'just like progn'. The documentation for progn states that its return value is the return value of the last command executed. Documentation for other-window states that it returns nil, which would support the assumption that save-excursion returns values similar to progn, which in the case of other-window would be nil. There is certainly nothing I can see that would indicate save-excursion returns the same value as current-buffer i.e. a buffer object. Tim -- tcross (at) rapttech dot com dot au