From: Tim X <timx@nospam.dev.null>
To: help-gnu-emacs@gnu.org
Subject: Re: (save-excursion (other-window 1)) leaves me in the other window
Date: Tue, 09 Mar 2010 17:45:38 +1100 [thread overview]
Message-ID: <87iq96ro19.fsf@rapttech.com.au> (raw)
In-Reply-To: m3mxyivjma.fsf@palantirtech.com
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
prev parent reply other threads:[~2010-03-09 6:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-05 20:33 (save-excursion (other-window 1)) leaves me in the other window Sean McAfee
2010-03-05 22:21 ` Joe Fineman
2010-03-07 6:55 ` Tim X
2010-03-08 3:09 ` Sean McAfee
2010-03-08 7:26 ` Tim X
2010-03-08 16:55 ` Sean McAfee
2010-03-08 17:02 ` Sean McAfee
2010-03-08 17:24 ` David Kastrup
2010-03-09 6:45 ` Tim X [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87iq96ro19.fsf@rapttech.com.au \
--to=timx@nospam.dev.null \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.