added option to disable magic open parens separately from magic close ones
svn: r2833 original commit: 1072ac68aa5e753a3e18cd674e1df26199759251
This commit is contained in:
parent
cf2a67cc6a
commit
e3cb1de717
|
@ -148,6 +148,7 @@
|
||||||
|
|
||||||
(preferences:set-default 'framework:highlight-parens #t boolean?)
|
(preferences:set-default 'framework:highlight-parens #t boolean?)
|
||||||
(preferences:set-default 'framework:fixup-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?)
|
(preferences:set-default 'framework:paren-match #t boolean?)
|
||||||
(let ([hash-table (make-hash-table)])
|
(let ([hash-table (make-hash-table)])
|
||||||
(for-each (λ (x)
|
(for-each (λ (x)
|
||||||
|
|
|
@ -656,7 +656,11 @@ for the last one, need a global "no more initialization can happen" flag.
|
||||||
values values)
|
values values)
|
||||||
(make-check scheme-panel
|
(make-check scheme-panel
|
||||||
'framework:fixup-parens
|
'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)
|
values values)
|
||||||
(make-check scheme-panel
|
(make-check scheme-panel
|
||||||
'framework:paren-match
|
'framework:paren-match
|
||||||
|
|
|
@ -975,7 +975,7 @@
|
||||||
(inherit is-frozen? is-stopped?)
|
(inherit is-frozen? is-stopped?)
|
||||||
(define/public (rewrite-square-paren)
|
(define/public (rewrite-square-paren)
|
||||||
(cond
|
(cond
|
||||||
[(or (not (preferences:get 'framework:fixup-parens))
|
[(or (not (preferences:get 'framework:fixup-open-parens))
|
||||||
(is-frozen?)
|
(is-frozen?)
|
||||||
(is-stopped?))
|
(is-stopped?))
|
||||||
(insert #\[
|
(insert #\[
|
||||||
|
@ -1248,10 +1248,10 @@
|
||||||
;; we found a new expression, two steps back, so we don't use the sibling
|
;; we found a new expression, two steps back, so we don't use the sibling
|
||||||
;; check here -- we just go with square brackets.
|
;; check here -- we just go with square brackets.
|
||||||
[(and backward-match2
|
[(and backward-match2
|
||||||
(text-between-equal? "new"
|
(ormap
|
||||||
text
|
(λ (x)
|
||||||
backward-match2
|
(text-between-equal? x text backward-match2 before-whitespace-pos2))
|
||||||
before-whitespace-pos2))
|
'("new" "case")))
|
||||||
(void)]
|
(void)]
|
||||||
[(member b-m-char '(#\( #\[ #\{))
|
[(member b-m-char '(#\( #\[ #\{))
|
||||||
;; found a "sibling" parenthesized sequence. use the parens it uses.
|
;; found a "sibling" parenthesized sequence. use the parens it uses.
|
||||||
|
@ -1305,11 +1305,13 @@
|
||||||
0)])
|
0)])
|
||||||
(cond
|
(cond
|
||||||
[(and second-backwards-match2
|
[(and second-backwards-match2
|
||||||
(text-between-equal? "let"
|
(ormap (λ (x)
|
||||||
|
(text-between-equal? x
|
||||||
text
|
text
|
||||||
second-backwards-match2
|
second-backwards-match2
|
||||||
second-before-whitespace-pos2))
|
second-before-whitespace-pos2))
|
||||||
;; found the `(let loop (' so we keep the [
|
'("let")))
|
||||||
|
;; found the `(let loop (' or `case' so we keep the [
|
||||||
(void)]
|
(void)]
|
||||||
[else
|
[else
|
||||||
;; otherwise, round.
|
;; otherwise, round.
|
||||||
|
|
|
@ -139,7 +139,9 @@
|
||||||
(build-open-bracket-spec "ab" 1 #\()
|
(build-open-bracket-spec "ab" 1 #\()
|
||||||
(build-open-bracket-spec "|ab|" 2 #\[)
|
(build-open-bracket-spec "|ab|" 2 #\[)
|
||||||
(build-open-bracket-spec "(let loop " 10 #\()
|
(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))
|
(send-sexp-to-mred `(send (make-object frame:basic% "dummy to trick frame group") show #t))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user