added option to disable magic open parens separately from magic close ones

svn: r2833

original commit: 1072ac68aa5e753a3e18cd674e1df26199759251
This commit is contained in:
Robby Findler 2006-04-28 08:57:05 +00:00
parent cf2a67cc6a
commit e3cb1de717
4 changed files with 21 additions and 12 deletions

View File

@ -148,6 +148,7 @@
(preferences:set-default 'framework:highlight-parens #t boolean?)
(preferences:set-default 'framework:fixup-parens #t boolean?)
(preferences:set-default 'framework:fixup-open-parens #t boolean?)
(preferences:set-default 'framework:paren-match #t boolean?)
(let ([hash-table (make-hash-table)])
(for-each (λ (x)

View File

@ -656,7 +656,11 @@ for the last one, need a global "no more initialization can happen" flag.
values values)
(make-check scheme-panel
'framework:fixup-parens
(string-constant fixup-parens)
(string-constant fixup-close-parens)
values values)
(make-check scheme-panel
'framework:fixup-open-parens
(string-constant fixup-open-parens)
values values)
(make-check scheme-panel
'framework:paren-match

View File

@ -975,7 +975,7 @@
(inherit is-frozen? is-stopped?)
(define/public (rewrite-square-paren)
(cond
[(or (not (preferences:get 'framework:fixup-parens))
[(or (not (preferences:get 'framework:fixup-open-parens))
(is-frozen?)
(is-stopped?))
(insert #\[
@ -1248,10 +1248,10 @@
;; we found a new expression, two steps back, so we don't use the sibling
;; check here -- we just go with square brackets.
[(and backward-match2
(text-between-equal? "new"
text
backward-match2
before-whitespace-pos2))
(ormap
(λ (x)
(text-between-equal? x text backward-match2 before-whitespace-pos2))
'("new" "case")))
(void)]
[(member b-m-char '(#\( #\[ #\{))
;; found a "sibling" parenthesized sequence. use the parens it uses.
@ -1305,11 +1305,13 @@
0)])
(cond
[(and second-backwards-match2
(text-between-equal? "let"
(ormap (λ (x)
(text-between-equal? x
text
second-backwards-match2
second-before-whitespace-pos2))
;; found the `(let loop (' so we keep the [
'("let")))
;; found the `(let loop (' or `case' so we keep the [
(void)]
[else
;; otherwise, round.

View File

@ -139,7 +139,9 @@
(build-open-bracket-spec "ab" 1 #\()
(build-open-bracket-spec "|ab|" 2 #\[)
(build-open-bracket-spec "(let loop " 10 #\()
(build-open-bracket-spec "(let loop (" 11 #\[)))
(build-open-bracket-spec "(let loop (" 11 #\[)
(build-open-bracket-spec "(case x " 8 #\[)
(build-open-bracket-spec "(case x [" 9 #\()))
(send-sexp-to-mred `(send (make-object frame:basic% "dummy to trick frame group") show #t))