[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (save-excursion (other-window 1)) leaves me in the other window
From: |
Tim X |
Subject: |
Re: (save-excursion (other-window 1)) leaves me in the other window |
Date: |
Tue, 04 May 2010 15:41:58 -0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.93 (gnu/linux) |
Sean McAfee <eefacm@gmail.com> writes:
> Tim X <timx@nospam.dev.null> writes:
>> Sean McAfee <eefacm@gmail.com> 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