[racket] Indenting with class

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sat Apr 14 15:55:52 EDT 2012

Oh-- I realized what I was doing wrong. I've pushed a change to fix
'new'. 'send' is still eluding me, tho. Maybe I'll see what's wrong
another time.

Thanks for pointing this out.


On Sat, Apr 14, 2012 at 11:27 AM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> I'm doing the opposite. I agree that the docs should match the right
> style, but DrRacket is generally what we consider to the be the right
> style.
> Robby
> On Sat, Apr 14, 2012 at 11:01 AM, Nick Shelley <nickmshelley at gmail.com> wrote:
>> I'm not sure I understand. Are you trying to change scribble to look more
>> like DrRacket's indenting?
>> The background to my original question was that I started going through the
>> GUI docs at http://docs.racket-lang.org/gui/windowing-overview.html and
>> noticed when I typed it into DrRacket it wouldn't indent the same, so I
>> assumed that the docs had the correct style and I just didn't know how to
>> set it up in DrRacket.
>> I guess my new question is, what is the best way to write OO code that uses
>> new and a bunch of bracketed arguments? For examples of what kind of code
>> I'm referring to, see the windowing docs I linked to above.
>> As far as scribble mirroring DrRacket, I think in general it would be good
>> to have all the code in the docs represent the best style for that type of
>> code and then make sure DrRacket's defaults make that easy. Is that what
>> you're doing with this diff?
>> Sorry if I completely misunderstood your response.
>> On Sat, Apr 14, 2012 at 9:37 AM, Robby Findler <robby at eecs.northwestern.edu>
>> wrote:
>>> I looked into this a little bit and with the diff below, it starts to
>>> get close to make the docs indent the way DrRacket does, but it looks
>>> like getting closer is going to be complicated because of the way the
>>> layout is set up and, I guess, that the layout is set up that way
>>> because that's the best compromise with the html/pdf backed that's
>>> been found.
>>> So I'm not really sure if the right thing is to try to lay out the
>>> table differently, or perhaps I'm missing something about the way the
>>> current things are set up that there is another simple tweak to do.
>>> In any case, the diff below makes the racket/draw canvas% docs's
>>> constructor line the first argument up under the "w" new "new",
>>> instead of under the "c" in "canvas%". The current setup seems to have
>>> the "new canvas%" all in a single cell in the canvas and judicious use
>>> of (hspace 1) doesn't seem to help.
>>> Robby
>>> diff --git a/collects/scribble/private/manual-proc.rkt
>>> b/collects/scribble/private/manual-proc.rkt
>>> index 5499aab..6780390 100644
>>> --- a/collects/scribble/private/manual-proc.rkt
>>> +++ b/collects/scribble/private/manual-proc.rkt
>>> @@ -363,7 +363,7 @@
>>>                             (list flow-spacer)
>>>                             (list flow-spacer flow-spacer
>>>                                   flow-spacer flow-spacer))]
>>> -                [one-ok? (tagged+arg-width . < . 60)])
>>> +                [one-ok? (and (not (eq? mode 'new)) (tagged+arg-width
>>> . < . 60))])
>>>              (list
>>>               (make-table
>>>                "prototype"
>>> On Sun, Apr 8, 2012 at 11:08 PM, Nick Shelley <nickmshelley at gmail.com>
>>> wrote:
>>> >
>>> > Punny, right? Anyway, I can't figure out how to get DrRacket to indent
>>> > like this:
>>> >
>>> > (define msg (new message% [parent frame]
>>> >                           [label "No events so far..."]))
>>> >
>>> > like it is in the docs. I've tried putting new in the begin-like,
>>> > define-like, and lambda-like sections of the preferences and none of them do
>>> > it. I'm sure there's a simple solution that's in an obvious place in the
>>> > docs, but it's eluding me right now. (I at least looked in the most obvious
>>> > place that I could think of, which is the DrRacket preferences section, but
>>> > the entry on indenting wasn't very helpful for what I want to know: "This
>>> > panel controls which keywords DrRacket recognizes for indenting, and how
>>> > each keyword is treated.")
>>> >
>>> > ____________________
>>> >  Racket Users list:
>>> >  http://lists.racket-lang.org/users
>>> >

Posted on the users mailing list.