
Hi. I am trying to reconfigure the racket repl to open in another emacs frame. Here is the Elisp code that can do this. The missing piece is that I don’t know what the name of racket repl process … (add-to-list 'display-buffer-alist
'("<???repl process????>". ((display-buffer-pop-up-window) .
((inhibit-same-window . t)))))

Does anyone knows?

I don’t know the buffer name, but I have the following in the .emacs which might be useful?
https://gist.github.com/soegaard/942a3074513655292816e0b79c466620#file-a-emacs-for-racket-L145

@kyp0717 For display-buffer-alist
I think you want the buffer name (not the process name). Which is good b/c Racket Mode supports N REPL buffers all sharing the same back end Racket process.
However that multi REPL support means the name of the REPL buffer can vary, depending on https://www.racket-mode.com/#racket_002drepl_002dbuffer_002dname_002dfunction.
What is your value for that?
If it’s the default, nil
, then you will have just one REPL buffer, and its name will be *Racket REPL*
, so that’s the simple case (use that in display-buffer-alist
, I think).
If it’s some other value, then I’m not sure but we could try to figure it out together.

Oh the display-buffer-alist
thing is a regexp for a buffer name. And all the default buffer-name functions Racket Mode uses all name the buffer starting with *Racket REPL
, so you should be able to use an Emacs regexp for that?

So e.g. if you’re using the thing for one REPL buffer shared among all files in the same project, the REPL buffer will be named *Racket REPL <project>*
. Or the 1:1 thing is *Racket REPL <path/to/file.rkt>*
.

So they all start with *Racket REPL
.

Maybe the Emacs regexp to use would be "\\`\\*Racket REPL"
??

Maybe "^\\*Racket REPL"
would also work? idk

p.s. as for the “action” half of it, I don’t think display-buffer-pop-up-window
will use a new frame (which I think you said you wanted)? But that’s a general Emacs question.

If you want “display buffer in some new frame, but don’t create another frame if it’s already in one” — I don’t think that’s any existing display-buffer-xxx
function; you might need to write your own. Not sure.

Neither display-buffer-pop-up-frame
nor display-buffer-use-some-frame
are quite that, exactly.

AFAICT

(from experimenting a bit just now, but I have to run now…)

thanks for everyone’s help

you both gave me some new ideas for testing.

let me experiment for a bit a get back to you all

How to prefix-in
when using submodules? For example, is this valid racket code. But when trying access a procedure using u:xxxxx
, it does not work IN enacs REPL. (require (prefix-in cr: (submod "credentials.rkt" cred))
(prefix-in u: (submod "credentials.rkt" urls))
(prefix-in net: net/http-easy ))

I am attempting to get Sketching on the package server, but the build server gives an error when building the documentation: cannot instantiate `racket/gui/base' a second time in the same process
Locally I am still using Racket 7.5 and there it seems to be fine.
Any ideas?
https://github.com/soegaard/sketching/tree/main/sketching-doc/sketching-doc
The error: raco setup: rendering: <pkgs>/sketching-doc/sketching-doc/manual-sketching.scrbl
cannot instantiate `racket/gui/base' a second time in the same process
context...:
body of "/home/root/racket/share/pkgs/gui-lib/mred/private/wx/common/once.rkt"
body of "/home/root/racket/share/pkgs/gui-lib/mred/private/wx/platform.rkt"
/home/root/racket/collects/racket/private/more-scheme.rkt:148:2: call-with-break-parameterization
/home/root/racket/share/pkgs/sandbox-lib/racket/sandbox.rkt:882:7
/home/root/racket/share/pkgs/sandbox-lib/racket/sandbox.rkt:853:2: user-process
The full log: https://pkg-build.racket-lang.org/server/built/fail/sketching-doc.txt

Make sure you are using the latest version of setup-racket
. I think it’s at v1.5 now.

I forgot to write, that the build works. The documentation still fails though. Due to the same error, the Racket build server gives.

Could it be from the requiring racket/draw require in make-sketching-eval
?

Hmm, nevermind it’s complaining about racket/gui/base not draw

The #lang sketching
language imports racket/gui
.

So almost all the examples use it.

This seems similar, but there doesn’t appear to have been any resolution: https://lists.racket-lang.org/users/archive/2012-May/052379.html

This may be promising: https://github.com/greghendershott/racket-mode/issues/26#issuecomment-38484706

I think the answer is that this is an unfixable limitation of racket/gui
+ sandboxes: https://www.mail-archive.com/racket-users@googlegroups.com/msg21853.html

I guess my 7.5 is older than this message :slightly_smiling_face:

No that’s a different message

the one you see is much older

my link is from 2014

Yes - but on macOS it worked for longer.

no that’s a different message; you can click the commit there

Where does sandbox come into play here? Is it from scribble or is it from the pkg server?

I’ll experiment with the solution SamPhilips links to.

scribble — there’s a sandbox for @examples

The solution I linked is related to the thread SamTH posted too.

Although I don’t know exactly what behavior you want, for me this puts REPL buffers in their own frame; creating a new frame only when does not exist. It might be satisfactory if you’re using the default config where a single *Racket REPL*
buffer is shared. (add-to-list 'display-buffer-alist
'("\\`\\*Racket REPL"
(display-buffer-reuse-window
display-buffer-pop-up-frame)
(reusable-frames . 0)
(inhibit-same-window . t)))

@kyp0717 ^ Anyway hopefully if not exactly what you want it gives you some ideas.

Thanks for tips. The documentation now builds on Github Action, so :crossed_fingers:hopefully it will also build on the Racket build server.

Yikes, I was so confused in 2014. Robby was so patient.

I wonder whether make-base-eval-factory
was added just for this purpose :slightly_smiling_face:

It works fine for me.
$ cat a.rkt
#lang racket
(module foo racket
(provide x)
(define x 1))
$ cat b.rkt
#lang racket
(require (prefix-in a: (submod "a.rkt" foo)))
a:x
$ racket b.rkt
1

hmm…it does not seem to work in the repl

$ racket
Welcome to Racket v8.2.0.2 [cs].
> (require (prefix-in a: (submod "a.rkt" foo)))
> a:x
1

seems to work for me

Actually, it works!!!! Thanks you very much!!! I will send this code to Greg - maintainer of racket-mode!

in the emacs repl?

That’s the Racket REPL, but I don’t see why Emacs REPL would be different. If it is, I would consider that a bug

Yeah, it works fine for me in Racket Mode REPL

ok perhaps I did something wrong

thanks for looking into it

It works now! Sorry to have bother you. It was an error in another file which caused this issue. Mispelled a word!

Thanks!

@chenhao.zhang.rea has joined the channel

Please tell him I said hello. :grinning:

@sistemas6755 has joined the channel