Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 28 additions & 39 deletions drracket-core-lib/drracket/private/module-language-tools.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -589,15 +589,12 @@
(send (send frame get-toolbar-button-panel) change-children (λ (prev) '()))

(define directly-specified-buttons
(map (λ (button-spec)
(new switchable-button%
[label (list-ref button-spec 0)]
[bitmap (list-ref button-spec 1)]
[parent (send frame get-toolbar-button-panel)]
[callback
(lambda (button)
((list-ref button-spec 2) frame))]))
cleaned-up-buttons))
(for/list ([button-spec (in-list cleaned-up-buttons)])
(new switchable-button%
[label (list-ref button-spec 0)]
[bitmap (list-ref button-spec 1)]
[parent (send frame get-toolbar-button-panel)]
[callback (lambda (button) ((list-ref button-spec 2) frame))])))
(define directly-specified-button-numbers
(map (λ (button-spec) (list-ref button-spec 3))
cleaned-up-buttons))
Expand Down Expand Up @@ -725,8 +722,7 @@
(define tmp-b (box #f))
(define fn (get-filename tmp-b))
(when (unbox tmp-b) (set! fn #f))
(define the-dir (get-init-dir fn))
the-dir)
(get-init-dir fn))

(super-new)

Expand Down Expand Up @@ -818,16 +814,15 @@
(error who
"no more online-expansion-handlers can be registered; got ~e ~e ~e"
mod-path id local-handler))
(for ([handler (in-list online-expansion-handlers)])
(when (and (equal? (online-expansion-handler-mod-path handler) mod-path)
(equal? (online-expansion-handler-id handler) id))
(error who
(string-append
"already registered a handler with the same mod-path and id\n"
" mod-path: ~e\n"
" id: ~e")
mod-path
id))))
(for ([handler (in-list online-expansion-handlers)]
#:when (and (equal? (online-expansion-handler-mod-path handler) mod-path)
(equal? (online-expansion-handler-id handler) id)))
(error who
(string-append "already registered a handler with the same mod-path and id\n"
" mod-path: ~e\n"
" id: ~e")
mod-path
id)))

(define online-expansion-pref-funcs '())
(define (get-online-expansion-pref-funcs) online-expansion-pref-funcs)
Expand All @@ -841,24 +836,18 @@
;; saving a file in Windows
(define (move-extension-first ext filters)
(define rx (regexp (string-append "(?:^|;)[*][.]" ext "(?:$|;)")))
(map (lambda (p)
(define exts (cadr p))
(define m (regexp-match-positions rx exts))
(if m
(list (car p)
(string-append (string-append "*." ext)
(if (or ((caar m) . > . 0)
((cdar m) . < . (string-length exts)))
";"
"")
(substring exts 0 (caar m))
(if (and ((caar m) . > . 0)
((cdar m) . < . (string-length exts)))
";"
"")
(substring exts (cdar m))))
p))
filters))
(for/list ([p (in-list filters)])
(define exts (cadr p))
(define m (regexp-match-positions rx exts))
(if m
(list (car p)
(string-append
(string-append "*." ext)
(if (or ((caar m) . > . 0) ((cdar m) . < . (string-length exts))) ";" "")
(substring exts 0 (caar m))
(if (and ((caar m) . > . 0) ((cdar m) . < . (string-length exts))) ";" "")
(substring exts (cdar m))))
p)))
(module+ test
(check-equal?
(move-extension-first
Expand Down
Loading