removed work around for bug in s-exp reader and improved error message for user-defined keybindings in the wrong language
svn: r16296 original commit: 1203aaa8861bca4fef0931790842289d147cc979
This commit is contained in:
parent
0b172f2272
commit
d49a39892c
|
@ -30,23 +30,27 @@
|
|||
(parameterize ([read-accept-reader #t])
|
||||
(call-with-input-file path read)))])
|
||||
(match sexp
|
||||
[`(module ,name ,(? valid-keybindings-lang?)
|
||||
[`(module ,name ,lang
|
||||
,@(x ...))
|
||||
(let ([km (dynamic-require spec '#%keymap)])
|
||||
(hash-set! user-keybindings-files spec km)
|
||||
(send user-keymap chain-to-keymap km #t))]
|
||||
(cond
|
||||
[(valid-keybindings-lang? lang)
|
||||
(let ([km (dynamic-require spec '#%keymap)])
|
||||
(hash-set! user-keybindings-files spec km)
|
||||
(send user-keymap chain-to-keymap km #t))]
|
||||
[else
|
||||
(error 'add-user-keybindings-file
|
||||
(string-constant user-defined-keybinding-malformed-file/found-lang)
|
||||
(path->string path)
|
||||
lang)])]
|
||||
[else (error 'add-user-keybindings-file
|
||||
(string-constant user-defined-keybinding-malformed-file)
|
||||
(path->string path))])))))
|
||||
|
||||
(define (valid-keybindings-lang? x)
|
||||
(let ([valid-langs
|
||||
(list `(lib "keybinding-lang.ss" "framework")
|
||||
`(lib "framework/keybinding-lang.ss")
|
||||
`framework/keybinding-lang)])
|
||||
(cond
|
||||
[(syntax? x) (member (syntax->datum x) valid-langs)]
|
||||
[else (member x valid-langs)])))
|
||||
(member x
|
||||
(list `(lib "keybinding-lang.ss" "framework")
|
||||
`(lib "framework/keybinding-lang.ss")
|
||||
`framework/keybinding-lang)))
|
||||
|
||||
(define (spec->path p)
|
||||
(cond
|
||||
|
|
Loading…
Reference in New Issue
Block a user