
@robby Currently for some reason it’s not possible to open a file in DrRacket from Quisckscript, but reordering tabs work. Any idea why?
More details: If you try this quickscript: #lang racket/base
(require quickscript
racket/gui/base
racket/class)
(define-script ask-open-in-tab
#:label "ask-open-in-tab"
(λ (selection #:frame fr)
(define fi (get-file))
(when fi (send fr open-in-new-tab fi))
#f))
it barks: Error in script file "/home/lorseau/.racket/quickscript/user-scripts/ask-open-in-tab.rkt":
namespace-attach-module: module not declared (in the source namespace)
module name: #<resolved-module-path:"/usr/share/racket/pkgs/drracket/drracket/tool-lib.rkt">
From here: https://github.com/Metaxal/quickscript/blob/master/tool.rkt#L151
I have no idea what this means :confused:

Just guessing but maybe you need to add a require or a dynamic require of drracket/tool-lib
before you parameterize yourself over to the new namespace? I’m not really clear why you’re making a new namespace, actually, so this may be bad advice. @laurent.orseau

Each script is run in a new namespace to avoid interaction between the scripts.
A (dynamic or not) require of drracket/tool-lib
would start an instance of DrRacket, wouldn’t it?

Well, DrRacket should already be started when quickscript is running, I suppose?

I think it will start yet another instance. At least that’s what happens if your (require drracket/tool-lib)
and run it in DrRacket. I don’t know how it all works though

If you create a new namespace and require it in the new namespace, it will attempt to start a new one.

right, ok

DrRacket creates a new namespace (and new other things) to separate the user’s program from it’s own implementation

The error message you posted says “I cannot share that module because I don’t have it in this namespace to share”

So depending on what you want to do and what else is going on there are different ways to fix that.

If you’re not running inside DrRacket as a tool already then you would need to be there for this to work

if you’re a tool inside drracket already and you’re getting that, then maybe you’ve created a new namespace “too early”?

Ok thanks. I kind of see, but I’m confused as of why rearranging drracket’s tabs works, but not opening a file in a new tab

Well, I can confidently say that it isn’t obvious to me from this description. Sorry!

Ok thanks. I will need to look at the code, but maybe reorder-tabs
bypasses some framework stuff and goes directly to the editor% whereas open-in-new-tab doesn’t. Is there a right way to make this
available in the new namespace so that the script invoked in the namespace can use send
on it?

On macOS does anyone know why DrRacket doesn’t handle the “Hide ⌘H” command? It vanishes only for a split second…