[slime-devel] Re: REPL frame activation

Helmut Eller heller at common-lisp.net
Tue Aug 19 21:20:37 UTC 2008


* Tobias C. Rittweiler [2008-08-19 11:10+0200] writes:

> I have no luck at customizing this through the variables described in
> `(elisp)Choosing Window'.

Hmm, I had the same problem.  First I implemented focus switching
manually; upgraded Emacs from CVS; dropped the focus switching code and
everything seemed to work.  But now it doesn't.

> And I begin to doubt that these variables are even meant to let you
> customize it. They're to customize the way buffers are _displayed_,
> but what slime-switch-to-output-buffer does it more, it's also about
> setting the input focus, and selecting the window if appropriate.

Well, the docstring of pop-to-buffer says explicitly that it uses
display-buffer.  So every variable that is meant for display-buffer is
also usable for pop-to-buffer.

pop-to-buffer is just (select-window (display-buffer ...)).  The
question is why select-window doesn't switch the input focus.

Obviously (form the source), select-window calls select-frame.  But
select-frame doesn't seem to switch the focus.  It looks kinda strange,
or at least unusual to select a frame without switching focus.  Maybe
it's intended for things like read-from-minibuffer.

> What I did a few days ago was to make this behaviour also happen when
> having two frames side-by-side, some window in the left frame displaying
> the REPL, the right frame displaying .lisp buffers. So I regarded my
> work as improving consistency. 

But we shouldn't ignore or reinvent standard customization variables.

>
> What I want is the following behaviour:
>
>  (let ((repl-window (get-buffer-window repl-buffer t)))
>    (if repl-window
>        (progn (select-frame-set-input-focus (window-frame repl-window))
>               (select-window repl-window))
>      (pop-to-buffer repl-buffer t)))

If pop-to-buffer can't be used directly, I rather want:

   (let ((window (display-buffer repl-buffer)))
      (select-window window)
      (select-frame-set-input-focus (window-frame window)))

In fact, I think pop-to-buffer should do that.

> Setting display-buffer-reuse-frames to t results in C-c C-z being a NOP
> because the REPL window is already displayed in a frame, but the window
> within that frame isn't selected and input focus isn't updated
> accordingly.

It's not quite a NOP for me: if I hide one frame behind the other, C-c
C-z brings the hidden frame in front.  It still isn't selected, though.

> Help greatly appreciated,

Maybe we just should ask the Emacs maintainers why pop-to-buffer doesn't
what we expect.

Helmut.




More information about the slime-devel mailing list