From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: with-current-buffer
Date: Tue, 28 Jun 2005 11:28:48 -0600 [thread overview]
Message-ID: <d9s0v1$oig$1@sea.gmane.org> (raw)
In-Reply-To: <87oe9rxpf5.fsf@jurta.org>
Juri Linkov wrote:
> What causes trouble here is the fact that Emacs changes the current
> buffer behind the scenes (somewhere in the main loop), so at the end
> of the function it is not known what the buffer will be current after
> the function finishes. But sometimes it is desirable to perform some
> actions on that buffer (e.g. run hooks).
But you also changed the selected window. That is the cause of the
trouble.
> Maybe with-current-buffer should keep track of switching buffers
> inside with-current-buffer, so it could anticipate what a buffer will
> be set as current and don't restore the old buffer.
>
> Or maybe `pop-to-buffer inside with-current-buffer' is not a suitable
> programming construct (I mean mostly for the `next-error' command
> where this problem occurred) and it's better to replace it with more
> explicit buffer switching that will restore the old buffer only when
> there were no `pop-to-buffer' calls.
In the old days we'd use save-window-excursion; now there is
save-selected-window.
Should there be a with-selected-window macro, analogous to
with-current-buffer?
--
Kevin Rodgers
next prev parent reply other threads:[~2005-06-28 17:28 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-24 5:36 fit-window-to-buffer Richard M. Stallman
2005-06-24 8:21 ` fit-window-to-buffer Juanma Barranquero
2005-06-26 23:33 ` with-current-buffer (was: fit-window-to-buffer) Juri Linkov
2005-06-27 6:28 ` Miles Bader
2005-06-28 0:04 ` with-current-buffer Juri Linkov
2005-06-28 17:28 ` Kevin Rodgers [this message]
2005-06-29 3:45 ` with-current-buffer Stefan Monnier
2005-06-29 17:45 ` with-current-buffer Kevin Rodgers
2005-06-28 18:47 ` with-current-buffer Richard M. Stallman
2005-06-28 23:52 ` next-error-hook (was: with-current-buffer) Juri Linkov
2005-06-27 16:46 ` with-current-buffer (was: fit-window-to-buffer) Richard M. Stallman
-- strict thread matches above, loose matches on Subject: below --
2005-09-11 15:00 with-current-buffer Emilio Lopes
2005-09-11 16:52 ` with-current-buffer Stefan Monnier
2005-09-11 19:23 ` with-current-buffer Emilio Lopes
2005-09-11 21:15 ` with-current-buffer Stefan Monnier
2005-09-12 17:15 ` with-current-buffer Emilio Lopes
2005-09-11 20:23 ` with-current-buffer Luc Teirlinck
2019-11-11 8:31 with-current-buffer Andreas Röhler
2019-11-11 9:04 ` with-current-buffer tomas
2019-11-11 10:58 ` with-current-buffer Andreas Röhler
2019-11-11 11:09 ` with-current-buffer tomas
2019-11-11 11:17 ` with-current-buffer Joost Kremers
2019-11-11 11:16 ` with-current-buffer Joost Kremers
2019-11-11 11:31 ` with-current-buffer Andreas Röhler
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='d9s0v1$oig$1@sea.gmane.org' \
--to=ihs_4664@yahoo.com \
/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.