[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: switch-to-buffer: for interactive use only

From: Chong Yidong
Subject: Re: switch-to-buffer: for interactive use only
Date: Wed, 13 Jul 2011 17:53:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

martin rudalics <address@hidden> writes:

> I think that we want two types of `switch-to-buffer' functions:
> (1) The one where using any window but the selected doesn't make sense.
>     This seems the case for C-x b and maybe a few other cases.  We could
>     use a `set-window-buffer' based function here and error out if the
>     selected window is strongly dedicated or the minibuffer window.
>     Call this function `switch-to-buffer-same-window' and bind C-x b to
>     it.  This function would be marked as not callable from Elisp.
> (2) A function that pops to a buffer, preferably in the selected window.
>     This is the case for almost all other calls of `switch-to-buffer'.
>     For this we could rewrite `switch-to-buffer' to call `pop-to-buffer'
>     with the 'same-window argument and, if Stefan insists, make it reuse
>     the same window even if it's weakly dedicated.  This function would
>     be callable from Elisp.

C-x b is usually called because the user wants to go to another buffer,
so if the selected window absolutely can't be used then it's better for
the command should intelligently handle it by using another window.

As for non-interactive usage, that's addressed by the FORCE-SAME-WINDOW
argument.  Those callers that want to force selecting the same window
specific can use this arg, so we don't need a different function.

After discussing with Stefan off-list, I've committed the change to
switch-to-buffer that adds the FORCE-SAME-WINDOW argument.  I'll get to
changing the callers shortly.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]