help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Deskt


From: Tassilo Horn
Subject: Re: Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop?
Date: Sat, 21 Jul 2007 09:55:10 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> If I eval
>
>>   (progn
>>     (setq pop-up-frames t)
>>     (display-buffer "*Group*"))
>
>> The *Group* buffer will be displayed in a new window, but no new frame
>> will be created.
>
> That's not what I see with the trunk of Emacs-CVS startd with "emacs
> -Q", so either it's been fixed, or it depends on some config of yours.

The error is on my side. :-)

I use my own `display-buffer-function' to have emacs split windows
horizontally by default. And, of course, I forgot to handle the
pop-up-frames case. Now I tried adding it, but I don't get it right. How
do I create a new frame and display a given buffer in it?

--8<---------------cut here---------------start------------->8---
(defun th-display-buffer (buffer force-other-window)
  (if pop-up-frames
      ;; This does not work... :-(
      (make-frame `((buffer-list . (,buffer))))
    (or (get-buffer-window buffer)
        (if (one-window-p)
            (let ((new-win (if (> (window-width) (if window-system 165 153))
                               (split-window-horizontally)
                             (split-window-vertically))))
              (set-window-buffer new-win buffer)
              new-win)
          (let ((new-win (get-lru-window)))
            (set-window-buffer new-win buffer)
            new-win)))))

(setq display-buffer-function 'th-display-buffer)
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo


reply via email to

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