kyp0717
2021-7-6 14:57:19

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)))))


kyp0717
2021-7-6 14:57:28

Does anyone knows?


soegaard2
2021-7-6 14:59:26

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


greg
2021-7-6 15:10:30

@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.


greg
2021-7-6 15:14:37

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?


greg
2021-7-6 15:15:53

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>*.


greg
2021-7-6 15:16:52

So they all start with *Racket REPL.


greg
2021-7-6 15:19:55

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


greg
2021-7-6 15:20:54

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


greg
2021-7-6 15:39:52

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.


greg
2021-7-6 15:40:42

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.


greg
2021-7-6 15:41:22

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


greg
2021-7-6 15:41:30

AFAICT


greg
2021-7-6 15:42:16

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


kyp0717
2021-7-6 16:10:45

thanks for everyone’s help


kyp0717
2021-7-6 16:10:59

you both gave me some new ideas for testing.


kyp0717
2021-7-6 16:11:07

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


kyp0717
2021-7-6 17:06:17

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 ))


soegaard2
2021-7-6 17:18:57

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


samdphillips
2021-7-6 17:23:09

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


soegaard2
2021-7-6 17:24:54

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

https://github.com/soegaard/sketching/actions


samdphillips
2021-7-6 17:36:37

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


samdphillips
2021-7-6 17:37:01

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


soegaard2
2021-7-6 17:37:42

The #lang sketching language imports racket/gui.


soegaard2
2021-7-6 17:38:02

So almost all the examples use it.


samdphillips
2021-7-6 17:42:54

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


samdphillips
2021-7-6 17:46:43

samth
2021-7-6 17:46:44

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


soegaard2
2021-7-6 17:48:59

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

https://github.com/racket/racket/issues/2426


samth
2021-7-6 17:49:28

No that’s a different message


samth
2021-7-6 17:49:34

the one you see is much older


samth
2021-7-6 17:49:49

my link is from 2014


soegaard2
2021-7-6 17:50:12

Yes - but on macOS it worked for longer.


samth
2021-7-6 17:51:14

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


shu--hung
2021-7-6 17:51:32

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


soegaard2
2021-7-6 17:51:36

I’ll experiment with the solution SamPhilips links to.


samth
2021-7-6 17:51:51

scribble — there’s a sandbox for @examples


samdphillips
2021-7-6 17:52:02

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


greg
2021-7-6 18:13:50

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)))


greg
2021-7-6 18:14:44

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


soegaard2
2021-7-6 18:26:17

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

https://github.com/soegaard/sketching/blob/main/sketching-doc/sketching-doc/manual-sketching.scrbl#L405


greg
2021-7-6 18:26:26

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


soegaard2
2021-7-6 18:30:11

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


sorawee
2021-7-6 19:01:02

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


kyp0717
2021-7-6 19:21:35

hmm…it does not seem to work in the repl


sorawee
2021-7-6 19:24:22

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


sorawee
2021-7-6 19:24:27

seems to work for me


kyp0717
2021-7-6 19:30:02

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


kyp0717
2021-7-6 20:01:22

in the emacs repl?


sorawee
2021-7-6 20:02:41

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


sorawee
2021-7-6 20:03:32

Yeah, it works fine for me in Racket Mode REPL


kyp0717
2021-7-6 20:03:50

ok perhaps I did something wrong


kyp0717
2021-7-6 20:03:57

thanks for looking into it


kyp0717
2021-7-6 20:42:09

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


kyp0717
2021-7-6 20:42:11

Thanks!


chenhao.zhang.rea
2021-7-6 20:46:24

@chenhao.zhang.rea has joined the channel


greg
2021-7-6 22:28:04

Please tell him I said hello. :grinning:


sistemas6755
2021-7-7 00:29:58

@sistemas6755 has joined the channel