Mercurial > emacs
comparison lisp/textmodes/ispell.el @ 90076:7feda13f67b6
These changes are to fix the code merged
from trunk for the change on 2005-01-13.
(ispell-unified-chars-table): Delete it.
(ispell-get-decoded-string): Don't check
ispell-unified-chars-table.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 17 Jan 2005 12:07:56 +0000 |
parents | cb67264d6096 |
children | 6d92d69fae33 |
comparison
equal
deleted
inserted
replaced
90075:c43084d0b52b | 90076:7feda13f67b6 |
---|---|
1072 (fboundp 'decode-coding-string) | 1072 (fboundp 'decode-coding-string) |
1073 (ispell-get-coding-system)) | 1073 (ispell-get-coding-system)) |
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 |
1119 (defun ispell-get-casechars () | 1089 (defun ispell-get-casechars () |
1120 (ispell-get-decoded-string 1)) | 1090 (ispell-get-decoded-string 1)) |