ccshan
2017-10-19 15:03:39

@ccshan has joined the channel


apg
2017-10-19 17:00:54

The trick I use is to put (when I’m on macOS) /Applications/Racket/bin in my path and then symlink (ln -s) the current Racket distribution to /Applications/Racket. So, futz with it once, and be done forever.


gknauth
2017-10-19 17:59:08

how do I make a text-field% right-justified?


dustin
2017-10-19 18:02:18

@apg thanks. I think what I did was add it to /etc/path.


mflatt
2017-10-19 20:16:10

@gknauth More difficult than it should be: (define text-field-right-align% (class text-field% (inherit get-editor get-client-size) (define/private (reset-width) (define e (get-editor)) (define wb (box 0.0)) (send (send e get-admin) get-view #f #f wb #f) (send e set-max-width (- (unbox wb) 2)) (send e set-paragraph-alignment 0 'right)) (define/override (on-size w h) (super on-size w h) (reset-width)) (init [callback void]) (super-new [callback (lambda (t e) ;; an editor tends to lose ;; its alignment if all the text ;; is deleted, so reset it ;; after any change (reset-width) (callback t e))]) (reset-width)))


gknauth
2017-10-19 20:17:27

@mflatt Awesome, thanks so much!


mflatt
2017-10-19 20:19:46

Well, the resizing part doesn’t work for me. It looks like on-size isn’t called on Mac OS, so that’s a bug.


gknauth
2017-10-19 20:36:16

It will take some tweaking, my digits are cut off a little on the right until I resize, but it’s a good start, and gives me something to work with, thanks again!


lexi.lambda
2017-10-19 21:30:36

I’m having a really rough time figuring out how to get Scribble to cooperate with multiple namespaces, largely because it seems like all the APIs for registering definitions of Racket identifiers are private APIs. Someone previously pointed me at some code that uses id-to-target-maker from scribble/private/manual-bind, but it’s all very complicated, and I don’t totally understand how it works.


lexi.lambda
2017-10-19 21:32:04

Frustratingly, Scribble doesn’t seem to be figuring out that my binding is being documented, complaining about undefined tags, but I have no idea how to debug why they aren’t defined.


lexi.lambda
2017-10-19 21:44:34

It looks like id-to-target-maker accepts an identifier?, but doesn’t actually use its lexical context? And the symbolic name matters?


mflatt
2017-10-19 21:52:56

@lexi.lambda Is xref-binding->definition-tag from scribble/xref (a public API) on the right path for what you want?


lexi.lambda
2017-10-19 21:55:34

That looks possibly closer, though I’m not sure how to use what it produces. I’m making my own form similar to defproc and friends, all of which appear to use this id-to-target-maker thing.


mflatt
2017-10-19 22:06:26

Actually, no, xref-binding->definition-tag is not the right thing. That’s for looking up a tag.


lexi.lambda
2017-10-19 22:07:57

Right. I’m looking to bind a tag. I got something that almost seems to work by carefully arranging for the symbolic name to be the right one, but as far as I can tell, it isn’t easily possible to render a link to a racket identifier with to-element’s #:defn? #t style without making the text of the link the symbolic name of the export.


mflatt
2017-10-19 22:11:55

That problem sounds familiar. I vaguely remember trying to work around that once myself and not succeeding, but I don’t remember the details or whether I found another way.


mflatt
2017-10-19 22:13:30

I think I tried to use make-element-id-transformer.


mflatt
2017-10-19 22:14:52

I may have ended up arranging a for-label import with the name that I wanted to render.


lexi.lambda
2017-10-19 22:15:07

I was thinking about trying for that latter thing.


lexi.lambda
2017-10-19 22:16:22

The unfortunate thing here is that, even if I do manage to get this working, the hacks are starting to pile up rather high. It’s not too bad if it’s all contained within Hackett’s implementation, but some of this Scribble stuff would leak out into users’ library documentation.


lexi.lambda
2017-10-19 22:17:15

And I usually try very hard to avoid complaining about this sort of thing, but the Scribble internals do not seem especially pleasant. :/


mflatt
2017-10-19 22:18:30

It’s even more of a prototype-that-got-out-of-hand than most things


lexi.lambda
2017-10-19 22:46:21

Well, I was feeling about ready to throw in the towel, but arranging for the right for-label import seems to have worked(ish), so that was helpful.


dedbox
2017-10-20 00:47:34

@dedbox has joined the channel