From: David Kastrup <dak@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: (save-excursion (other-window 1)) leaves me in the other window
Date: Mon, 08 Mar 2010 18:24:11 +0100 [thread overview]
Message-ID: <873a0aybes.fsf@lola.goethe.zz> (raw)
In-Reply-To: m3hboqvj98.fsf@palantirtech.com
Sean McAfee <smcafee@palantirtech.com> writes:
> Sean McAfee <eefacm@gmail.com> writes:
>> 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).
>
> Argh. Of course the expression I meant to write was:
>
> (eq (current-buffer) (progn (save-excursion arbitrary-forms) (current-buffer)))
>
> This actually does return t in the presence of multiple windows even if
> arbitrary-forms is (other-window 1), and yet the cursor still ends up in
> a different window than the one it was in before evaluating the
> expression. I still don't get it. I guess maybe other-window doesn't
> switch windows immediately, but defers the switch until after the
> expression has been fully evaluated?
other-window changes the current window, not the current buffer. When
Emacs returns to the command loop, the current buffer is set to the
window-buffer of the current window.
--
David Kastrup
next prev parent reply other threads:[~2010-03-08 17:24 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 [this message]
2010-03-09 6:45 ` Tim X
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=873a0aybes.fsf@lola.goethe.zz \
--to=dak@gnu.org \
--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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).