show a dialog box saying that aspell/ispell cannot be
found instead of just silently not checking the spelling also, fix a bug in that case that used to cause drracket to just crash original commit: 4787361d7f0598751f962b28739a0cc79b3d0194
This commit is contained in:
parent
fc583a9210
commit
39a8843206
|
@ -4,13 +4,27 @@
|
|||
racket/contract)
|
||||
|
||||
(provide/contract
|
||||
[query-aspell (-> (and/c string? (not/c #rx"[\n]")) (listof (list/c number? number?)))])
|
||||
[query-aspell (-> (and/c string? (not/c #rx"[\n]")) (listof (list/c number? number?)))]
|
||||
[find-aspell-binary-path (-> (or/c path? #f))])
|
||||
|
||||
(define aspell-candidate-paths
|
||||
'("/usr/bin"
|
||||
"/usr/local/bin"
|
||||
"/bin"))
|
||||
|
||||
(define (find-aspell-binary-path)
|
||||
(define aspell (if (eq? (system-type) 'windows) "aspell.exe" "aspell"))
|
||||
(define ispell (if (eq? (system-type) 'windows) "ispell.exe" "ispell"))
|
||||
(or (find-executable-path aspell)
|
||||
(find-executable-path ispell)
|
||||
(for/or ([cp aspell-candidate-paths])
|
||||
(define c1 (build-path cp aspell))
|
||||
(define c2 (build-path cp ispell))
|
||||
(or (and (file-exists? c1)
|
||||
c1)
|
||||
(and (file-exists? c2)
|
||||
c2)))))
|
||||
|
||||
(define aspell-req-chan (make-channel))
|
||||
(define aspell-thread #f)
|
||||
(define (start-aspell-thread)
|
||||
|
@ -24,17 +38,9 @@
|
|||
(define (fire-up-aspell)
|
||||
(unless already-attempted-aspell?
|
||||
(set! already-attempted-aspell? #t)
|
||||
(define asp (or (find-executable-path "aspell")
|
||||
(find-executable-path "ispell")
|
||||
(for/or ([cp aspell-candidate-paths])
|
||||
(define c1 (build-path cp "aspell"))
|
||||
(define c2 (build-path cp "ispell"))
|
||||
(or (and (file-exists? c1)
|
||||
c1)
|
||||
(and (file-exists? c2)
|
||||
c2)))))
|
||||
(define aspell? (regexp-match? #rx"aspell" (path->string asp)))
|
||||
(define asp (find-aspell-binary-path))
|
||||
(when asp
|
||||
(define aspell? (regexp-match? #rx"aspell" (path->string asp)))
|
||||
(set! aspell-proc (apply process* asp "-a" (if aspell? '("--encoding=utf-8") '())))
|
||||
(define line (read-line (list-ref aspell-proc 0)))
|
||||
(log-info (format "framework: started speller: ~a" line))
|
||||
|
|
Loading…
Reference in New Issue
Block a user