diff options
| -rw-r--r-- | lisp/textmodes/ispell.el | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 0c4aeb1bd24..4565d369371 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -1074,45 +1074,15 @@ Protects against bogus binding of `enable-multibyte-characters' in XEmacs." | |||
| 1074 | (decode-coding-string str (ispell-get-coding-system)) | 1074 | (decode-coding-string str (ispell-get-coding-system)) |
| 1075 | str)) | 1075 | str)) |
| 1076 | 1076 | ||
| 1077 | (put 'ispell-unified-chars-table 'char-table-extra-slots 0) | 1077 | ;; Return a string decoded from Nth element of the current dictionary. |
| 1078 | |||
| 1079 | ;; Char-table that maps an Unicode character (charset: | ||
| 1080 | ;; latin-iso8859-1, mule-unicode-0100-24ff, mule-unicode-2500-34ff) to | ||
| 1081 | ;; a string in which all equivalent characters are listed. | ||
| 1082 | |||
| 1083 | (defconst ispell-unified-chars-table | ||
| 1084 | (let ((table (make-char-table 'ispell-unified-chars-table))) | ||
| 1085 | (map-char-table | ||
| 1086 | #'(lambda (c v) | ||
| 1087 | (if (and v (/= c v)) | ||
| 1088 | (let ((unified (or (aref table v) (string v)))) | ||
| 1089 | (aset table v (concat unified (string c)))))) | ||
| 1090 | ucs-mule-8859-to-mule-unicode) | ||
| 1091 | table)) | ||
| 1092 | |||
| 1093 | ;; Return a string decoded from Nth element of the current dictionary | ||
| 1094 | ;; while splice equivalent characters into the string. This splicing | ||
| 1095 | ;; is done only if the string is a regular expression of the form | ||
| 1096 | ;; "[...]" because, otherwise, splicing will result in incorrect | ||
| 1097 | ;; regular expression matching. | ||
| 1098 | |||
| 1099 | (defun ispell-get-decoded-string (n) | 1078 | (defun ispell-get-decoded-string (n) |
| 1100 | (let* ((slot (assoc ispell-dictionary ispell-dictionary-alist)) | 1079 | (let* ((slot (assoc ispell-dictionary ispell-dictionary-alist)) |
| 1101 | (str (nth n slot))) | 1080 | (str (nth n slot))) |
| 1102 | (when (and (> (length str) 0) | 1081 | (when (and (> (length str) 0) |
| 1103 | (not (multibyte-string-p str))) | 1082 | (not (multibyte-string-p str))) |
| 1104 | (setq str (ispell-decode-string str)) | 1083 | (setq str (ispell-decode-string str)) |
| 1105 | (if (and (= (aref str 0) ?\[) | 1084 | (or (multibyte-string-p str) |
| 1106 | (eq (string-match "\\]" str) (1- (length str)))) | 1085 | (setq str (string-to-multibyte str))) |
| 1107 | (setq str | ||
| 1108 | (string-as-multibyte | ||
| 1109 | (mapconcat | ||
| 1110 | #'(lambda (c) | ||
| 1111 | (let ((unichar (aref ucs-mule-8859-to-mule-unicode c))) | ||
| 1112 | (if unichar | ||
| 1113 | (aref ispell-unified-chars-table unichar) | ||
| 1114 | (string c)))) | ||
| 1115 | str "")))) | ||
| 1116 | (setcar (nthcdr n slot) str)) | 1086 | (setcar (nthcdr n slot) str)) |
| 1117 | str)) | 1087 | str)) |
| 1118 | 1088 | ||