ispell (not aspell) doesn't seem to deal correctly with non-ASCII words
so just don't try to spell check them unless we know we have aspell
This commit is contained in:
parent
c3f4b5dedd
commit
48d2de53d5
|
@ -95,6 +95,7 @@
|
||||||
(define aspell-proc #f)
|
(define aspell-proc #f)
|
||||||
(define already-attempted-aspell? #f)
|
(define already-attempted-aspell? #f)
|
||||||
(define current-dict #f)
|
(define current-dict #f)
|
||||||
|
(define is-actually-aspell? #f)
|
||||||
|
|
||||||
(define (fire-up-aspell)
|
(define (fire-up-aspell)
|
||||||
(unless already-attempted-aspell?
|
(unless already-attempted-aspell?
|
||||||
|
@ -105,6 +106,8 @@
|
||||||
(define line (with-handlers ((exn:fail? exn-message))
|
(define line (with-handlers ((exn:fail? exn-message))
|
||||||
(read-line (list-ref aspell-proc 0))))
|
(read-line (list-ref aspell-proc 0))))
|
||||||
(asp-log (format "framework: started speller: ~a" line))
|
(asp-log (format "framework: started speller: ~a" line))
|
||||||
|
(when (regexp-match? #rx"[Aa]spell" line)
|
||||||
|
(set! is-actually-aspell? #t))
|
||||||
|
|
||||||
(when (and (string? line)
|
(when (and (string? line)
|
||||||
(regexp-match #rx"[Aa]spell" line))
|
(regexp-match #rx"[Aa]spell" line))
|
||||||
|
@ -129,7 +132,12 @@
|
||||||
(close-output-port (list-ref aspell-proc 1))
|
(close-output-port (list-ref aspell-proc 1))
|
||||||
(close-input-port (list-ref aspell-proc 3))
|
(close-input-port (list-ref aspell-proc 3))
|
||||||
(proc 'kill)
|
(proc 'kill)
|
||||||
(set! aspell-proc #f))
|
(set! aspell-proc #f)
|
||||||
|
(set! is-actually-aspell? #f))
|
||||||
|
|
||||||
|
(define (is-ascii? l)
|
||||||
|
(for/and ([s (in-string l)])
|
||||||
|
(<= (char->integer s) 127)))
|
||||||
|
|
||||||
(let loop ()
|
(let loop ()
|
||||||
(sync
|
(sync
|
||||||
|
@ -147,7 +155,9 @@
|
||||||
(sync (channel-put-evt resp-chan resp)
|
(sync (channel-put-evt resp-chan resp)
|
||||||
nack-evt))
|
nack-evt))
|
||||||
(cond
|
(cond
|
||||||
[aspell-proc
|
[(and aspell-proc
|
||||||
|
(or is-actually-aspell?
|
||||||
|
(is-ascii? line)))
|
||||||
(define stdout (list-ref aspell-proc 0))
|
(define stdout (list-ref aspell-proc 0))
|
||||||
(define stdin (list-ref aspell-proc 1))
|
(define stdin (list-ref aspell-proc 1))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user