DrRacket and Scribble datums

How do I persuade DrRacket to let me type an opening square bracket to introduce a datum after the command, as in this example from the Scribble docs: @foo[#:width 2]{blah blah}

It insists on inserting an open parenthesis instead. This is in v8.16 on macOS. Is this a bug? Usually DrRacket seems pretty smart about parens versus brackets, and my module did open with #lang scribble/base.

Hi, @stevebyan.

If I understand you correctly, the setting you are looking for, might be here:


(The only unticked one)

I hope that helps. Never had the behaviour change spontaneously, before.

I'd prefer not to disable it completely, rather just override it when it's wrong.

I found an answer in the DrRacket docs. If you type ctrl-[, it disables the auto-adjust of the square brackets.

Still, it would be nice if DrRacket understood @-syntax in #lang scribble.

1 Like

It would be nice, true. But it isn't clear what square bracket should do when you type @foo and then type [. Maybe { is actually the best choice (as that's more common), which means that we'd have to keep using control-[, anyway.

Anyway, right now, this special casing isn't specific to the #lang-line. If you're curious, it is implemented by this function; there may be a way to improve things.

Thanks for the pointer to the function. I suppose I'd want { as the first choice, unless the next character is already a {. In that case I'd want it to insert [].

Oh, that's a nice idea!