-
-
Notifications
You must be signed in to change notification settings - Fork 71
/
main.rkt
654 lines (576 loc) · 26.7 KB
/
main.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
#lang racket/unit
(require racket/class
racket/contract
racket/list
"sig.rkt"
"../preferences.rkt"
mred/mred-sig
mrlib/panel-wob)
(import mred^
[prefix preferences: framework:preferences^]
[prefix exit: framework:exit^]
[prefix group: framework:group^]
[prefix handler: framework:handler^]
[prefix editor: framework:editor^]
[prefix color-prefs: framework:color-prefs^]
[prefix racket: framework:racket^]
[prefix early-init: framework:early-init^]
[prefix color: framework:color^])
(export framework:main^)
(init-depend framework:preferences^ framework:exit^ framework:editor^
framework:color-prefs^ framework:racket^ framework:early-init^)
(preferences:low-level-get-preference preferences:get-preference/gui)
(preferences:low-level-put-preferences preferences:put-preferences/gui)
(application-preferences-handler (λ () (preferences:show-dialog)))
(preferences:set-default 'framework:caret-blink-disable? #f boolean?)
(preferences:set-default 'framework:editor-x-selection-mode #t boolean?)
(when (equal? (system-type) 'unix)
(preferences:add-callback
'framework:editor-x-selection-mode
(λ (p v) (editor-set-x-selection-mode v))))
(preferences:set-default 'framework:ascii-art-enlarge #f boolean?)
(preferences:set-default 'framework:color-scheme
(if (white-on-black-panel-scheme?)
'white-on-black
'classic)
symbol?)
(preferences:set-default 'framework:column-guide-width
'(#f 102)
(list/c boolean? (and/c exact-integer? (>=/c 2))))
(preferences:set-default 'framework:aspell-dict #f (λ (x) (or (not x) (string? x))))
(preferences:set-default 'framework:line-spacing-add-gap?
(not (eq? (system-type) 'windows))
boolean?)
;; used to time how long it takes to set a preference; the value is not actually used.
(preferences:set-default 'drracket:prefs-debug #f (λ (x) #t))
;; 'framework:spell-check-on? is only for people who had set
;; prefs in old versions; it isn't used except to provide the
;; default values for the newer prefs: 'framework:spell-check-strings?
;; and 'framework:spell-check-text?
(preferences:set-default 'framework:spell-check-on? #f boolean?)
(preferences:set-default 'framework:spell-check-strings?
(preferences:get 'framework:spell-check-on?)
boolean?)
(preferences:set-default 'framework:spell-check-text?
(preferences:get 'framework:spell-check-on?)
boolean?)
(preferences:set-default 'framework:always-use-platform-specific-linefeed-convention #f boolean?)
(preferences:set-default 'framework:overwrite-mode-keybindings #f boolean?)
(preferences:set-default 'framework:ask-about-paste-normalization #t boolean?)
(preferences:set-default 'framework:do-paste-normalization #t boolean?)
(preferences:set-default 'framework:replace-visible? #f boolean?)
(preferences:set-default 'framework:anchored-search #f boolean?)
(let ([search/replace-string-predicate
(λ (l)
(and (list? l)
(andmap
(λ (x) (or (string? x) (is-a? x snip%)))
l)))])
(preferences:set-default 'framework:search-string
'()
search/replace-string-predicate)
(preferences:set-default 'framework:replace-string
'()
search/replace-string-predicate))
;; marshalling for this one will just lose information. Too bad.
(preferences:set-un/marshall 'framework:search-string
(λ (l)
(map (λ (x)
(if (is-a? x snip%)
(send x get-text 0 (send x get-count))
x))
l))
values)
(preferences:set-default 'framework:paren-color-scheme 'basic-grey symbol?)
(define cond/offset-defaults
'(("case-lambda" 0)
("match-lambda" 0)
("match-lambda*" 0)
("cond" 0)
("field" 0)
("provide/contract" 0)
("match" 1)
("new" 1)
("case" 1)
("datum-case" 1)
("match" 1)
("match*" 1)
("syntax-parse" 1)
("syntax-rules" 1)
("syntax-case" 2)
("syntax-case*" 3)
("kernel-syntax-case" 2)
("kernel-syntax-case*" 3)))
(preferences:set-default 'framework:square-bracket:cond/offset
cond/offset-defaults
(listof (list/c string? exact-nonnegative-integer?)))
(preferences:set-un/marshall
'framework:square-bracket:cond/offset
(λ (val)
(define deletions (for/list ([line (in-list cond/offset-defaults)]
#:unless (ormap (λ (val-line)
(equal? (car line) (car val-line)))
val))
(list-ref line 0)))
(define additions/changes (for/list ([line (in-list val)]
#:when (not (member line cond/offset-defaults)))
line))
(list additions/changes deletions))
(λ (marsh)
(cond
[((listof (list/c string? exact-nonnegative-integer?)) marsh)
;; old style prefs: don't try to find any deletions, as they are
;; probably caused by a stale defaults setting
(define ht (make-hash (map (λ (x) (cons (list-ref x 0) (list-ref x 1))) cond/offset-defaults)))
(for ([line (in-list marsh)])
(hash-set! ht (list-ref line 0) (list-ref line 1)))
(hash-map ht list)]
[((list/c (listof (list/c string? exact-nonnegative-integer?)) (listof string?)) marsh)
;; new style-pref
(define additions/changes (list-ref marsh 0))
(define deletions (list-ref marsh 1))
(define ht (make-hash (map (λ (x) (cons (list-ref x 0) (list-ref x 1))) cond/offset-defaults)))
(for ([del (in-list deletions)])
(hash-remove! ht del))
(for/list ([line (in-list additions/changes)])
(hash-set! ht (list-ref line 0) (list-ref line 1)))
(hash-map ht list)])))
(define (set-square-bracket-nonum-pref pref-sym defaults)
(preferences:set-default pref-sym defaults (listof string?))
(preferences:set-un/marshall
pref-sym
(λ (val)
(define additions '())
(define deletions '())
(for ([itm (in-list val)])
(unless (member itm defaults)
(set! additions (cons itm additions))))
(for ([def (in-list defaults)])
(unless (member def val)
(set! deletions (cons def deletions))))
(list additions deletions))
(λ (marshed)
(cond
[((listof string?) marshed)
;; this is the old preference; in this case
;; we ignore any deletions while unmarshalling
;; as those are likely caused by a defaults
;; set that got bigger
(remove-duplicates (append marshed defaults))]
[((list/c (listof string?) (listof string?)) marshed)
(define additions (list-ref marshed 0))
(define deletions (list-ref marshed 1))
(append additions (remove* deletions defaults))]))))
(set-square-bracket-nonum-pref 'framework:square-bracket:local
'("local"))
(define all-fors
(let ()
(define base-fors
'(for for/list for/hash for/hasheq for/hasheqv for/and for/or
for/lists for/first for/last for/vector for/flvector
for/sum for/product for/set))
(define untyped-fors
(append base-fors
(map (λ (x) (string->symbol (regexp-replace #rx"^for" (symbol->string x) "for*")))
base-fors)))
(define all-fors
(append untyped-fors
(map (λ (x) (string->symbol (string-append (symbol->string x) ":")))
untyped-fors)))
all-fors))
(define for/folds '("for/fold" "for/fold:" "for*/fold" "for*/fold:" "for/foldr" "for*/foldr"))
(set-square-bracket-nonum-pref 'framework:square-bracket:letrec
(append (map symbol->string all-fors)
for/folds
'("let"
"let*" "let-values" "let*-values"
"let-syntax" "let-struct" "let-syntaxes"
"match-let" "match-let*" "match-letrec"
"letrec"
"letrec-syntaxes" "letrec-syntaxes+values" "letrec-values"
"parameterize" "parameterize*" "syntax-parameterize"
"with-syntax" "with-handlers")))
(set-square-bracket-nonum-pref 'framework:square-bracket:for/fold for/folds)
(preferences:set-default 'framework:white-on-black? (white-on-black-panel-scheme?) boolean?)
(preferences:set-default 'framework:case-sensitive-search?
#f
boolean?)
(color-prefs:add-color-scheme-entry 'framework:basic-canvas-background "white" "black")
(preferences:set-default 'framework:special-meta-key #f boolean?)
(preferences:add-callback 'framework:special-meta-key (λ (p v) (map-command-as-meta-key v)))
(map-command-as-meta-key (preferences:get 'framework:special-meta-key))
(preferences:set-default 'framework:any-control+alt-is-altgr #f boolean?)
(preferences:add-callback 'framework:any-control+alt-is-altgr (λ (p v) (any-control+alt-is-altgr v)))
(any-control+alt-is-altgr (preferences:get 'framework:any-control+alt-is-altgr))
(preferences:set-default 'framework:fraction-snip-style
'mixed (λ (x) (memq x '(mixed improper decimal))))
(preferences:set-default 'framework:standard-style-list:font-name
(cond
[(equal? (system-type) 'macosx)
(define preferred-font "Menlo")
(define fl (get-face-list))
(if (member preferred-font fl)
preferred-font
(get-family-builtin-face 'modern))]
[else (get-family-builtin-face 'modern)])
string?)
(preferences:set-default
'framework:standard-style-list:font-size
(vector (hash)
(let* ([txt (make-object text%)]
[stl (send txt get-style-list)]
[bcs (send stl basic-style)])
(send bcs get-size)))
(vector/c
;; font sizes for specific monitor configurations
(hash/c
;; a particular monitor configuration: the widths and heights
(non-empty-listof (list/c exact-nonnegative-integer?
exact-nonnegative-integer?))
;; the font size for that configuration
(integer-in 0 255)
#:flat? #t)
;; default font size, when none of the configs above apply
(integer-in 0 255)
#:flat? #t))
(preferences:set-un/marshall
'framework:standard-style-list:font-size
values
(λ (x)
(if (exact-nonnegative-integer? x)
;; coerce old pref settings to new
(vector (hash) x)
x)))
(preferences:set-default
'framework:standard-style-list:smoothing
'default
(λ (x)
(memq x '(unsmoothed partly-smoothed smoothed default))))
(preferences:set-default
'framework:standard-style-list:weight
'normal
(λ (x)
(memq x '(normal light bold))))
(editor:set-standard-style-list-pref-callbacks)
(let ([gray-level
;; old gray-level 192
(if (eq? (system-type) 'windows)
(* 3/4 256)
(- (* 7/8 256) 1))])
(define default-color (make-object color% 0 0 0 (- 1. (/ gray-level 255))))
(define w-o-b-default-color (make-object color% 255 255 255 (/ 50 255)))
(color-prefs:add-color-scheme-entry 'framework:paren-match-color
default-color
w-o-b-default-color)
;; when the preference is currently set to the old color,
;; then just update it to the new one (if someone really
;; wants the old default, they can still have a color that is
;; off by one from the old default which should be ok)
(define current-color (color-prefs:lookup-in-color-scheme 'framework:paren-match-color))
(cond
[(and (= (send current-color red) gray-level)
(= (send current-color green) gray-level)
(= (send current-color blue) gray-level)
(= (send current-color alpha) 1.0))
(color-prefs:set-in-color-scheme 'framework:paren-match-color default-color)]
[(and (= (send current-color red) 50)
(= (send current-color green) 50)
(= (send current-color blue) 50)
(= (send current-color alpha) 1.0))
(color-prefs:set-in-color-scheme 'framework:paren-match-color w-o-b-default-color)]))
(preferences:set-default 'framework:recently-opened-files/pos
null
(λ (x) (and (list? x)
(andmap
(λ (x)
(and (list? x)
(= 3 (length x))
(path? (car x))
(number? (cadr x))
(number? (caddr x))))
x))))
(preferences:set-un/marshall
'framework:recently-opened-files/pos
(λ (l) (map (λ (ele) (cons (path->bytes (car ele)) (cdr ele))) l))
(λ (l)
(let/ec k
(unless (list? l)
(k '()))
(map (λ (x)
(unless (and (list? x)
(= 3 (length x))
(bytes? (car x))
(number? (cadr x))
(number? (caddr x)))
(k '()))
(cons (bytes->path (car x)) (cdr x)))
l))))
(preferences:set-default 'framework:last-directory
(find-system-path 'doc-dir)
(λ (x) (or (not x) path-string?)))
(preferences:set-un/marshall 'framework:last-directory
(λ (x) (and (path? x) (path->bytes x)))
(λ (x)
(and (bytes? x)
(bytes->path x))))
(preferences:set-default 'framework:recent-max-count
50
(λ (x) (and (number? x)
(x . > . 0)
(integer? x))))
(preferences:add-callback
'framework:recent-max-count
(λ (p v)
(handler:size-recently-opened-files v)))
(preferences:set-default 'framework:last-url-string "" string?)
(preferences:set-default 'framework:recently-opened-sort-by 'age
(λ (x) (or (eq? x 'age) (eq? x 'name))))
(preferences:set-default 'framework:recent-items-window-w 400 number?)
(preferences:set-default 'framework:recent-items-window-h 600 number?)
(preferences:set-default 'framework:show-delegate? #f boolean?)
(preferences:set-default 'framework:windows-mdi #f boolean?)
(preferences:set-default 'framework:menu-bindings #t boolean?)
(preferences:set-default 'framework:verify-change-format #f boolean?)
(preferences:set-default 'framework:auto-set-wrap? #f boolean?)
(preferences:set-default 'framework:display-line-numbers #t boolean?)
(preferences:set-default 'framework:show-status-line #t boolean?)
(preferences:set-default 'framework:col-offsets #f boolean?)
(preferences:set-default
'framework:print-output-mode
'standard
(λ (x) (or (eq? x 'standard) (eq? x 'postscript) (eq? x 'pdf))))
(preferences:set-default 'framework:highlight-parens #t boolean?)
(preferences:set-default 'framework:fixup-parens #t boolean?)
(preferences:set-default 'framework:fixup-open-parens #f boolean?)
(preferences:set-default 'framework:paren-match #t boolean?)
(let ([defaults-ht (make-hasheq)])
(for-each (λ (x) (hash-set! defaults-ht x 'for/fold))
'(for/fold for/fold: for*/fold for*/fold:
for/lists for/lists: for*/lists for*/lists:))
(for-each (λ (x) (hash-set! defaults-ht x 'define))
'(struct
local
struct: define-struct: define-typed-struct define-struct/exec:
define: pdefine:
define-type define-predicate
match-define match-define-values))
(for-each (λ (x) (hash-set! defaults-ht x 'begin))
'(case-lambda case-lambda: pcase-lambda:
match-lambda match-lambda*
syntax-parser
cond
delay
unit compound-unit compound-unit/sig
public private override require
inherit sequence
;; Explicitly indent these with- constructs using begin-like style
;; for otherwise they will be captured by the regexp of lambda-like style
with-output-to-string with-output-to-bytes
with-module-reading-parameterization))
(for-each (λ (x) (hash-set! defaults-ht x 'lambda))
`(
cases
instantiate super-instantiate
syntax/loc quasisyntax/loc
datum-case
match match* match-let match-let* match-letrec
λ lambda let let* letrec recur
lambda/kw
letrec-values
with-syntax with-syntax*
with-continuation-mark
module module* module+
match match-let match-let* match-letrec
let/cc let/ec letcc catch
let-syntax letrec-syntax fluid-let-syntax letrec-syntaxes+values
let: letrec: let*:
let-values: letrec-values: let*-values:
let/cc: let/ec:
lambda: λ:
plambda: opt-lambda: popt-lambda:
splicing-let splicing-letrec splicing-let-values
splicing-letrec-values splicing-let-syntax
splicing-letrec-syntax splicing-let-syntaxes
splicing-letrec-syntaxes splicing-letrec-syntaxes+values
splicing-local splicing-parameterize splicing-syntax-parameterize
do:
kernel-syntax-case
syntax-case syntax-case* syntax-rules syntax-id-rules
syntax-parse
let-signature fluid-let
let-struct let-macro let-values let*-values
case when unless
let-enumerate
class class* class-asi class-asi* class*/names
class100 class100* class100-asi class100-asi* class100*/names
rec
make-object mixin
define-some do opt-lambda
send* with-method
define-record
catch shared
unit/sig unit/lang
with-handlers
interface
parameterize parameterize* syntax-parameterize
call-with-input-file call-with-input-file* with-input-from-file
with-input-from-string
with-input-from-port call-with-output-file
with-output-to-file with-output-to-port
for-all
big-bang
type-case))
(preferences:set-default
'framework:tabify
(list defaults-ht #rx"^begin" #rx"^def" #rx"^(for\\*?(/|$)|with-)" #f)
(list/c (hash/c symbol? (or/c 'for/fold 'define 'begin 'lambda) #:flat? #t)
(or/c #f regexp?) (or/c #f regexp?) (or/c #f regexp?) (or/c #f regexp?)))
(define old-style-pred? (listof (list/c symbol? symbol?)))
(define new-style-pred?
(list/c (listof (list/c symbol? symbol?)) ;; additions to defaults
(listof (list/c symbol? symbol?)))) ;; deletions
(define pref-pred?
(or/c (list/c new-style-pred?
(or/c regexp? #f)
(or/c regexp? #f)
(or/c regexp? #f)
(or/c regexp? #f))
(list/c (or/c old-style-pred? new-style-pred?)
(or/c regexp? #f)
(or/c regexp? #f)
(or/c regexp? #f))))
(define (ht->addition/deletion-lists ht)
(define additions '())
(define deletions '())
(for ([(k v) (in-hash ht)])
(unless (hash-ref defaults-ht k #f)
(set! additions (cons (list k v) additions))))
(for ([(k v) (in-hash defaults-ht)])
(unless (hash-ref ht k #f)
(set! deletions (cons (list k v) deletions))))
(list additions deletions))
(define (addition/deletion-lists->ht lsts)
(define additions (list-ref lsts 0))
(define deletions (list-ref lsts 1))
(define ht (hash-copy defaults-ht))
(for ([pr (in-list deletions)])
(define k (list-ref pr 0))
(define v (list-ref pr 1))
(when (equal? (hash-ref ht k #f) v)
(hash-remove! ht k)))
(for ([pr (in-list additions)])
(define k (list-ref pr 0))
(define v (list-ref pr 1))
(hash-set! ht k v))
ht)
(define (pad-to len lst)
(cond
[(null? lst) (build-list len (λ (x) #f))]
[else (cons (car lst) (pad-to (- len 1) (cdr lst)))]))
(preferences:set-un/marshall
'framework:tabify
(λ (t) (cons (ht->addition/deletion-lists (list-ref t 0))
(cdr t)))
(λ (l)
(and (pref-pred? l)
(cond
[(old-style-pred? (list-ref l 0))
;; when migrating prefs from the old style,
;; get rid of any apparent deletions, as
;; they are likely unintentional, a result
;; of moving defaults
(define h (make-hasheq))
(for-each (λ (x) (apply hash-set! h x)) (list-ref l 0))
(define lsts (ht->addition/deletion-lists h))
(cons (addition/deletion-lists->ht (list (list-ref l 0)
'()))
(cdr l))]
[else
(cons (addition/deletion-lists->ht (list-ref l 0))
(pad-to 4 (cdr l)))])))))
(preferences:set-default 'framework:autosave-delay 30 number?)
(preferences:set-default 'framework:autosaving-on? #t boolean?)
(preferences:set-default 'framework:backup-files? #t boolean?)
(preferences:set-default 'framework:autoload 'ask (or/c boolean? 'ask))
(preferences:set-default 'framework:verify-exit #t boolean?)
(preferences:set-default 'framework:delete-forward? #t boolean?)
(preferences:set-default 'framework:show-periods-in-dirlist #f boolean?)
(preferences:set-default 'framework:file-dialogs 'std
(λ (x) (and (memq x '(common std)) #t)))
(for ([line (in-list (racket:get-color-prefs-table))]
[white-on-black-line (in-list (racket:get-white-on-black-color-prefs-table))])
(define sym (car line))
(define color (cadr line))
(define white-on-black-color (cadr white-on-black-line))
(color-prefs:add-color-scheme-entry (racket:short-sym->pref-name sym)
#:style (racket:short-sym->style-name sym)
color
white-on-black-color))
(color-prefs:add-color-scheme-entry 'framework:program-contour-current-location-bar
"light blue"
(make-object color% 93 104 158))
(preferences:set-default 'framework:coloring-active #t boolean?)
(color-prefs:add-color-scheme-entry 'framework:line-numbers-current-line-number-background
"forestgreen"
(make-object color% 108 186 112))
(color-prefs:add-color-scheme-entry 'framework:line-numbers-current-line-number-foreground
"white"
"black")
(color-prefs:add-color-scheme-entry 'framework:line-numbers-when-word-wrapping
"darkgray"
"darkgray")
(color-prefs:add-color-scheme-entry 'framework:line-numbers
"black"
"lightgray")
(color-prefs:add-color-scheme-entry 'framework:default-text-color "black" "white")
(color-prefs:register-color-scheme-entry-change-callback
'framework:default-text-color
(λ (v)
(editor:set-default-font-color v)))
(editor:set-default-font-color
(color-prefs:lookup-in-color-scheme 'framework:default-text-color))
(color-prefs:add-color-scheme-entry 'framework:misspelled-text-color "black" "white")
(color-prefs:add-color-scheme-entry 'framework:warning-background-color
"yellow"
(make-object color% #x9b #x87 #x0c))
(color-prefs:add-color-scheme-entry 'framework:failed-search-background-color "pink" "firebrick")
(color-prefs:add-color-scheme-entry 'framework:disabled-background-color "gray" "dim gray")
(color-prefs:set-default/color-scheme 'framework:delegatee-overview-color
"light blue"
(make-object color% 62 67 155))
(let ([delta (make-object style-delta%)]
[style (send (editor:get-standard-style-list) find-named-style
color:misspelled-text-color-style-name)])
(if style
(send style set-delta delta)
(send (editor:get-standard-style-list) new-named-style color:misspelled-text-color-style-name
(send (editor:get-standard-style-list) find-or-create-style
(send (editor:get-standard-style-list) find-named-style "Standard")
delta))))
(let ([update-style-list
(λ (v)
(define sl (editor:get-standard-style-list))
(define style (send sl find-named-style color:misspelled-text-color-style-name))
(define delta (new style-delta%))
(send style get-delta delta)
(send delta set-delta-foreground v)
(send style set-delta delta))])
(color-prefs:register-color-scheme-entry-change-callback
'framework:misspelled-text-color
(λ (v) (update-style-list v)))
(update-style-list
(color-prefs:lookup-in-color-scheme 'framework:misspelled-text-color)))
;; groups
(preferences:set-default 'framework:exit-when-no-frames #t boolean?)
(unless (preferences:get 'framework:exit-when-no-frames)
(preferences:set 'framework:exit-when-no-frames #t))
(exit:insert-can?-callback
(λ ()
(send (group:get-the-frame-group) can-close-all?)))
(exit:insert-on-callback
(λ ()
(send (group:get-the-frame-group) on-close-all)))
;; reset these -- they are only for the test suite.
;; they do not need to be set across starting up and shutting down
;; the application.
;(preferences:set 'framework:file-dialogs 'std)