aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2005-01-13 04:33:05 +0000
committerKenichi Handa2005-01-13 04:33:05 +0000
commit8253213c1029505f4ca6a8ff3f2e338579c1099c (patch)
tree0460f0a171c9487e671af1ea9ec75151cca24a63
parente2244c1dd9d0d1d872fc2f0f9fd1b6079ad30951 (diff)
downloademacs-8253213c1029505f4ca6a8ff3f2e338579c1099c.tar.gz
emacs-8253213c1029505f4ca6a8ff3f2e338579c1099c.zip
(ispell-unified-chars-table): New variable.
(ispell-get-decoded-string): New function. (ispell-get-casechars, ispell-get-not-casechars) (ispell-get-otherchars): Call ispell-get-decoded-string.
-rw-r--r--lisp/textmodes/ispell.el51
1 files changed, 45 insertions, 6 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index f3a7616bfd6..0c4aeb1bd24 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1074,15 +1074,54 @@ 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)
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)
1100 (let* ((slot (assoc ispell-dictionary ispell-dictionary-alist))
1101 (str (nth n slot)))
1102 (when (and (> (length str) 0)
1103 (not (multibyte-string-p str)))
1104 (setq str (ispell-decode-string str))
1105 (if (and (= (aref str 0) ?\[)
1106 (eq (string-match "\\]" str) (1- (length 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))
1117 str))
1118
1077(defun ispell-get-casechars () 1119(defun ispell-get-casechars ()
1078 (ispell-decode-string 1120 (ispell-get-decoded-string 1))
1079 (nth 1 (assoc ispell-dictionary ispell-dictionary-alist))))
1080(defun ispell-get-not-casechars () 1121(defun ispell-get-not-casechars ()
1081 (ispell-decode-string 1122 (ispell-get-decoded-string 2))
1082 (nth 2 (assoc ispell-dictionary ispell-dictionary-alist))))
1083(defun ispell-get-otherchars () 1123(defun ispell-get-otherchars ()
1084 (ispell-decode-string 1124 (ispell-get-decoded-string 3))
1085 (nth 3 (assoc ispell-dictionary ispell-dictionary-alist))))
1086(defun ispell-get-many-otherchars-p () 1125(defun ispell-get-many-otherchars-p ()
1087 (nth 4 (assoc ispell-dictionary ispell-dictionary-alist))) 1126 (nth 4 (assoc ispell-dictionary ispell-dictionary-alist)))
1088(defun ispell-get-ispell-args () 1127(defun ispell-get-ispell-args ()