[racket] Extending DrRacket with non-text tabs

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri Nov 14 08:44:32 EST 2014

On Fri, Nov 14, 2014 at 5:36 AM, Dmitry Pavlov <dpavlov at ipa.nw.ru> wrote:
> Robby,
>
>> Sorry for the long delay in replying.
>
>
> Never mind---I have been distracted by other things recently, and
> now I am back to work on this, so your reply is in fact just in time,
> thanks :)
>
>> You should be able to use handler:insert-format-handler to open your
>> frame when a file with your extension is opened via the open dialog.
>
>
> Good, insert-format-handler will suffice my needs I think.
> Dumb question follows: what is the best place to call
> insert-format-handler from?
>
> To be more specific about my goals:
> I have a Racket installation, and I would like to have this
> format handler registered by the moment a user starts DrRacket
> and opens some file in it.
>
> I tried and hijacked
> /opt/racket/share/pkgs/drracket/drracket/private/main.rkt
> to insert my (handler:insert-format-handler) to it, but
> this surely does not seem to be a good solution.
>
> My spreadsheet-editing module is currently in a collection
> that is "raco link"-ed to the Racket installation. Is there
> a way to call (handler:insert-format-handler) from a collection
> module before the collection is (require)-d? Or can I form
> a package from my collection and use some package mechanism
> for that?

Yes. See: http://docs.racket-lang.org/tools/implementing-tools.html

You probably want to call it just from the top-level of your unit (not
from phase1 or phase2).

> Also, a related question: what would you recommend for
> adding a certain file type to the DrRacket's file->open
> dialog, where currently are "Racket Sources" and "Any"?

I think you should call finder:default-filters (using the old value to
construct a new value).

Robby

Posted on the users mailing list.