
@ccshan has joined the channel

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.

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

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

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

@mflatt Awesome, thanks so much!

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.

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!

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.

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.

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

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

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.

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

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.

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.

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

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

I was thinking about trying for that latter thing.

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.

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

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

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 has joined the channel