indenter fix

pull/2/head
Matthew Butterick 9 years ago
parent c1b9497b33
commit ce1b56d019

@ -28,20 +28,11 @@
(require racket/class) (require racket/class)
(define (indenter t pos) (define (indenter t pos)
(define reserved-terms (map string->list '("with-pattern" "with-shared-id" "define-macro"))) (send t compute-racket-amount-to-indent pos (λ(x)
(case x
(define sexp-start-pos (send t find-up-sexp pos)) [("with-pattern" "with-shared-id") 'lambda]
(define paren-length 1) [("define-macro") 'define]
(define sexp-name-start (send t skip-whitespace (+ paren-length (or sexp-start-pos 0)) 'forward #t)) [else #f]))))
(define sexp-name (for*/list ([p (in-naturals sexp-name-start)]
[c (in-value (send t get-character p))]
#:break (char-whitespace? c))
c))
(and (member sexp-name reserved-terms)
(let* ([paranum (send t position-paragraph sexp-name-start)]
[psp (send t paragraph-start-position paranum)]
[prev-indent (- sexp-name-start psp)])
(add1 prev-indent)))) ; #f will trigger default indentation
(define (my-get-info key default default-filter) (define (my-get-info key default default-filter)
(case key (case key

@ -2,5 +2,7 @@
(define collection 'multi) (define collection 'multi)
(define version "0.01") (define version "0.01")
(define deps '("base" "sugar")) (define deps '("base"
"sugar"
["gui-lib" #:version "1.26"])) ; for indenter fix
(define build-deps '("racket-doc" "rackunit-lib" "scribble-lib")) (define build-deps '("racket-doc" "rackunit-lib" "scribble-lib"))

Loading…
Cancel
Save