When I use tuareg I like to have the toplevel in a separate frame, but as soon as I evaluate some code in the original frame the toplevel window reopen in that frame and that's not what I wan't.
More generally, I'd like to always popup new windows into frames as I'm using emacs daemon and a tiling window manager, I would like to replace all the window part of emacs by the frame.
There's a function to pop a window into a frame but I'd like to change the default behaviour.
How tuareg works :
I can open ocaml interpreter with C-c C-s
, if the interpreter isn't running it runs it in a new buffer called *ocaml toplevel* in a new window splitted horizontally. If it's already opened but the window at the bottom isn't, it open the window with the already opened *ocaml toplevel* in it.
It is binded to the function :
(defun tuareg-run-ocaml ()
"Run an OCaml toplevel process. I/O via buffer `*ocaml-toplevel*'."
(interactive)
(tuareg-run-process-if-needed)
(display-buffer tuareg-interactive-buffer-name))
I guess that it's display-buffer
whih I wan't to hack...
There's also evaluate region and evaluate buffer that evaluate some code in the tuareg buffer by the opened interpreter, and if it's not opened it opens it in a new window at the bottom like previously. In fact, it is quite similar to elisp evaluation but the result is in the *\ocaml toplevel* buffer and the window is always reopened when needed to show the result.
I don't show these functions because they call other tuareg functions so there would be a lot of functions in the post and I don't want to bother you with all that code. Jus tell me if you want more.
Thanks
display-buffer-alist
-- that will not cover all the situations, but it will as to many. – lawlist Dec 21 '15 at 17:51split-window-preferred-function
which I guess is what is called to popup things like tuareg toplevel or other sort of menus... I have tried to replace it with the same value aspop-up-frame-function
i.e.(lambda nil (make-frame pop-up-frame-alist))
but that one doesn't work as I expected, it open the buffer in the current frame. – Nicolas Scotto Di Perto Dec 21 '15 at 18:51M-x describe-key
&M-x find-find-function
. There may of course be a reader of this thread intimately familiar with tuareg. – lawlist Dec 21 '15 at 21:39tuareg.el
: https://github.com/ocaml/tuareg/blob/master/tuareg.el It is now bedtime (1:00 a.m.) and I will check back tomorrow to see if this question is still unresolved -- I don't want to rush and make a mistake, and then leave you hanging while I am soundly sleeping . . . :) – lawlist Dec 22 '15 at 08:54one-window-per-frame-mode
to prevents emacs from splitting windows (for a more unified world ;) ), and it does. But when I'm in tuareg and I run the toplevel, it switch the buffer when I want it to open a new frame and it always does that when I evaluate some code which is quite annoying... I would like to replace splitting to opening frame and, if possible, if the frame already exists, just switch to it. – Nicolas Scotto Di Perto Dec 22 '15 at 23:08tuareg-interactive-buffer-name
will display in the largest window in that "TUAREG" frame. The plan is to modify the function namedtuareg-run-ocaml
; but, exceptions may need to be added. – lawlist Dec 22 '15 at 23:19tuareg-run-ocaml
, then we will need to add some exceptions and I will need your help to identify what those exceptions are . . . – lawlist Dec 23 '15 at 01:57