[racket-dev] [plt] Push #21078: master branch updated
But this is editing the user's preferences, not setting the defaults.
Robby
On Mon, Sep 13, 2010 at 3:52 PM, Eli Barzilay <eli at barzilay.org> wrote:
> On Sep 13, Robby Findler wrote:
>> DrRacket doesn't yet have good tool support for such things, but it
>> should at least look at the #lang line for indentation and probably
>> will do that at some point (in which case the dialog will change to
>> be letting you add things to what the #lang line specifies instead
>> of just specifying everything). But not today, I'm sorry to say.
>
> Here's the code from my class tool:
>
> (define (add-form-specs)
> (define (sethash! t key val)
> (unless (hash-ref t key #f) (hash-set! t key val)))
> (define (setalist l key val)
> (if (assoc key l) l (cons (list key val) l)))
> (let ([t (car (preferences:get 'framework:tabify))])
> (for ([s '(define: define-type)])
> (sethash! t s 'define))
> (for ([s '(lambda: cases)])
> (sethash! t s 'lambda)))
> (let* ([l1 (preferences:get 'framework:square-bracket:cond/offset)]
> [l2 (setalist l1 "define-type" 1)]
> [l2 (setalist l2 "cases" 1)]
> [l2 (setalist l2 "match" 1)])
> (unless (equal? l1 l2)
> (preferences:set 'framework:square-bracket:cond/offset l2))))
>
> (A minor extension to the preferences could probably even do that
> without writing the file.)
>
> --
> ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
> http://barzilay.org/ Maze is Life!
>