Commit ef128a91 authored by Kenichi Handa's avatar Kenichi Handa
Browse files

(ispell-region): Take acount of the fact that `ispell'

will return OFFSET by counting non-ASCII characters as one.
(ispell-dictionary-alist-1): Add coding systems to each entry.
(ispell-dictionary-alist-2): Likewise.
(ispell-get-coding-system): New function.
(ispell-decode-string): New function.
(ispell-get-casechars): Decode the string if necessary.
(ispell-get-not-casechars, ispell-get-otherchars): Likewise.
parent 5c6257e5
......@@ -502,15 +502,15 @@ for language-specific arguments."
"[']" t ("-C" "-d" "deutsch") "~latin1")
"[']" t ("-C" "-d" "deutsch") "~latin1" iso-latin-1)
("nederlands" ; nederlands.aff
"[']" t ("-C") nil)
"[']" t ("-C") nil iso-latin-1)
("nederlands8" ; dutch8.aff
"[']" t ("-C") nil)))
"[']" t ("-C") nil iso-latin-1)))
(defvar ispell-dictionary-alist-2
......@@ -519,20 +519,21 @@ for language-specific arguments."
"[']" nil ("-C") nil)
("svenska8" ;8 bit swedish mode
"[A-Za-z\345\344\366\305\304\366]" "[^A-Za-z\345\344\366\305\304\366]"
"[']" nil ("-C" "-d" "svenska") "~list") ; Add `"-T" "list"' instead?
"[']" nil ("-C" "-d" "svenska") "~list" ; Add `"-T" "list"' instead?
"[A-Za-z]" "[^A-Za-z]" "[`'^---]" t nil nil)
("francais" ; francais.aff
"[---']" t nil "~list")
"[---']" t nil "~list" iso-latin-1)
("francais-tex" ; francais.aff
"[---'^`\"]" t nil "~tex")
"[---'^`\"]" t nil "~tex" iso-latin-1)
("dansk" ; dansk.aff
"[A-Z\306\330\305a-z\346\370\345]" "[^A-Z\306\330\305a-z\346\370\345]"
"[']" nil ("-C") nil)
"[']" nil ("-C") nil iso-latin-1)
......@@ -706,18 +707,30 @@ language.aff file \(e.g., english.aff\).")
(defvar ispell-offset 1
"Offset that maps protocol differences between ispell 3.1 versions.")
(defun ispell-decode-string (str)
(let (coding-system)
(if (and enable-multibyte-characters
(setq coding-system (ispell-get-coding-system)))
(decode-coding-string str coding-system)
(defun ispell-get-casechars ()
(nth 1 (assoc ispell-dictionary ispell-dictionary-alist)))
(nth 1 (assoc ispell-dictionary ispell-dictionary-alist))))
(defun ispell-get-not-casechars ()
(nth 2 (assoc ispell-dictionary ispell-dictionary-alist)))
(nth 2 (assoc ispell-dictionary ispell-dictionary-alist))))
(defun ispell-get-otherchars ()
(nth 3 (assoc ispell-dictionary ispell-dictionary-alist)))
(nth 3 (assoc ispell-dictionary ispell-dictionary-alist))))
(defun ispell-get-many-otherchars-p ()
(nth 4 (assoc ispell-dictionary ispell-dictionary-alist)))
(defun ispell-get-ispell-args ()
(nth 5 (assoc ispell-dictionary ispell-dictionary-alist)))
(defun ispell-get-extended-character-mode ()
(nth 6 (assoc ispell-dictionary ispell-dictionary-alist)))
(defun ispell-get-coding-system ()
(nth 7 (assoc ispell-dictionary ispell-dictionary-alist)))
(defvar ispell-process nil
"The process object for Ispell.")
......@@ -1606,6 +1619,9 @@ scrolling the current window. Leave the new window selected."
ispell-filter-continue nil
ispell-process-directory default-directory)
(set-process-filter ispell-process 'ispell-filter)
(if (and enable-multibyte-characters
(set-process-coding-system ispell-process (ispell-get-coding-system)))
(accept-process-output ispell-process) ; Get version ID line
(cond ((null ispell-filter)
(error "%s did not output version line" ispell-program-name))
......@@ -1815,8 +1831,20 @@ With prefix argument, set the default directory."
(while (and (not ispell-quit) ispell-filter)
(setq poss (ispell-parse-output (car ispell-filter)))
(if (listp poss) ; spelling error occurred.
(let* ((word-start (+ start offset-change
(car (cdr poss))))
(let* ((word-start
(if (and enable-multibyte-characters
;; OFFSET returned by ispell
;; counts non-ASCII chars as
;; one, so just adding OFFSET
;; to START will cause an
;; error.
(goto-char (+ start offset-change))
(forward-char (car (cdr poss)))
(+ start offset-change
(car (cdr poss)))))
(word-end (+ word-start
(length (car poss))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment