[Top][All Lists]

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

RE: display-buffer-other-frame - useful? doc string?

From: Drew Adams
Subject: RE: display-buffer-other-frame - useful? doc string?
Date: Sun, 6 Apr 2008 00:52:24 -0700

> The problem is that display-buffer doesn't work as it should.
> So we should fix display-buffer.  Can you try the following:
>   (lexical-let ((f pop-up-frame-function))
>     (setq pop-up-frame-function
>       (lambda ()
>         (let ((win (selected-window)))
>           (unwind-protect
>               (funcall f)
>             (when (window-live-p win)
>               (select-window win)
>               (select-frame-set-input-focus (window-frame win))))))))
> If this works, can you try to inline select-frame-set-input-focus and
> remove each part one by one until you figure out which part 
> is necessary and which part isn't.

Sorry, I don't understand what you would like me to do. Looking at that code, it
seems clear enough, but I don't understand what problem it is trying to solve or
what you would like me to try. In what way does display-buffer not work
correctly? What problems with dynamic binding do you see or foresee?

If I eval that code I get this: (void-function lexical-let)

OK, I found that lexical-let is in cl.el. After loading that, the code seems to
do nothing. 

I tried using it as the body of `display-buffer-other-frame', adding a call to
`display-buffer'. That too didn't work - the buffer was opened in the same
frame. I added `pop-up-frames', like this:

(defun display-buffer-other-frame (buffer)
  "Show BUFFER in another frame, but don't select it.
See documentation of `display-buffer' for more information."
  (interactive "BDisplay buffer in other frame: ")
  (lexical-let ((f pop-up-frame-function))
    (setq pop-up-frame-function
      (lambda ()
        (let ((win (selected-window)))
              (funcall f)
            (when (window-live-p win)
              (select-window win)
              (select-frame-set-input-focus (window-frame win)))))))
    (let ((pop-up-frames t))
      (display-buffer buffer t t))))

That just did the same thing as `switch-to-buffer-other-frame': the frame was

I'm obviously not guessing what it is you want me to try. Why don't you just
give me the complete code to try?

> The difficulty is that select-frame-set-input-focus doesn't 
> do the right thing in my situation: it raises the current frame
> whereas it shouldn't be doing that.

If `select-frame-set-input-focus' doesn't work in your situation, then perhaps
that's the place to debug? It seems to DTRT here (Windows). Emacs would be
unusable for me without it, given the way I use multiple frames, including for
side operations during completion.

If you let me know more clearly what you want, I'll give it a try. But it sounds
like there is a `select-frame-set-input-focus problem' in some contexts, in
addition to trying to get `display-buffer-other-frame' well-defined.

The code I sent works fine here, AFAICT. Maybe the problem is just to fix the
`select-frame-set-input-focus' problem you see at your end?

reply via email to

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