dont use get-keyword-type as the parameter name

This commit is contained in:
Robby Findler 2016-06-28 10:10:29 -05:00
parent 09519347e2
commit af33c70558
2 changed files with 12 additions and 12 deletions

View File

@ -86,20 +86,20 @@
@defmethod[#:mode public-final
(compute-racket-amount-to-indent
[pos exact-nonnegative-integer?]
[get-keyword-type
[get-head-sexp-type
(-> string? (or/c #f 'lambda 'define 'begin 'for/fold 'other))
(λ (x) #f)])
exact-nonnegative-integer?]{
Computes the amount of space to indent the line containing @racket[pos],
using the default s-expression indentation strategy.
The function @racket[get-keyword-type] is consulted for each symbol/keyword
The function @racket[get-head-sexp-type] is consulted for each symbol/keyword
that follows an open parenthesis. If it returns @racket[#f], then the
user's preferences (from the @onscreen{Indenting} panel of the @onscreen{Editing}
panel in the preferences dialog) are used.
@history[#:added "1.9"
#:changed "1.26" @list{Added the @racket[get-keyword-type] argument.}]
#:changed "1.26" @list{Added the @racket[get-head-sexp-type] argument.}]
}
@defmethod[#:mode augment

View File

@ -564,15 +564,15 @@
tab-char?))
(define/pubment (compute-amount-to-indent pos)
(inner (compute-racket-amount-to-indent pos) compute-amount-to-indent pos))
(define/public-final (compute-racket-amount-to-indent pos [_get-keyword-type (λ (x) #f)])
(define/public-final (compute-racket-amount-to-indent pos [_get-head-sexp-type (λ (x) #f)])
(cond
[(is-stopped?) #f]
[else
(define get-keyword-type
(define get-head-sexp-type
(let ([tabify-prefs (preferences:get 'framework:tabify)])
(λ (text)
(or (_get-keyword-type text)
(get-keyword-type-from-prefs text tabify-prefs)))))
(or (_get-head-sexp-type text)
(get-head-sexp-type-from-prefs text tabify-prefs)))))
(define last-pos (last-position))
(define para (position-paragraph pos))
(define is-tabbable?
@ -631,7 +631,7 @@
(let ([text (get-text contains id-end)])
(cond
[(member (classify-position contains) '(keyword symbol))
(get-keyword-type text)]
(get-head-sexp-type text)]
[else
'other]))))
(define (procedure-indent)
@ -1369,7 +1369,7 @@
(cond
[(and (eq? type 'symbol)
(string? lexeme)
(get-keyword-type-from-prefs lexeme tabify-pref))
(get-head-sexp-type-from-prefs lexeme tabify-pref))
(values lexeme 'keyword paren start end backup-delta new-mode)]
[else
(values lexeme type paren start end backup-delta new-mode)]))
@ -1388,9 +1388,9 @@
(|[| |]|)
(|{| |}|))))))
;; get-keyword-type-from-prefs : string (list ht regexp regexp regexp)
;; -> (or/c #f 'lambda 'define 'begin 'for/fold)
(define (get-keyword-type-from-prefs text pref)
;; get-head-sexp-type-from-prefs : string (list ht regexp regexp regexp)
;; -> (or/c #f 'lambda 'define 'begin 'for/fold)
(define (get-head-sexp-type-from-prefs text pref)
(define ht (car pref))
(define beg-reg (list-ref pref 1))
(define def-reg (list-ref pref 2))