From: hayashi Date: Mon, 9 Jul 2001 07:18:16 +0000 (+0000) Subject: * egg-edep.el (egg-string-match-charset): More portable definition. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=1b52d84aa6db4d95603fb8af02594716336b9515;p=elisp%2Ftamago.git * egg-edep.el (egg-string-match-charset): More portable definition. (egg-string-match-charset-end): New function. Compute where matched charset ends. * egg-cnv.el (egg-separate-languages): Call egg-string-match-charset-end instead of match-string. --- diff --git a/ChangeLog b/ChangeLog index 4833de5..edd5b8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2001-07-09 Yoshiki Hayashi + * egg-edep.el (egg-string-match-charset): More portable definition. + (egg-string-match-charset-end): New function. + Compute where matched charset ends. + * egg-cnv.el (egg-separate-languages): Call egg-string-match-charset-end + instead of match-string. + +2001-07-09 Yoshiki Hayashi + * egg/wnn.el (wnn-accept-charset-alist): XEmacs uses sisheng instead of chinese-sisheng. * egg-cnv.el (egg-separate-language): Ditto. diff --git a/egg-cnv.el b/egg-cnv.el index 745fe35..60444d5 100644 --- a/egg-cnv.el +++ b/egg-cnv.el @@ -402,7 +402,7 @@ mode, if non-NIL." (cond ((eq cset 'chinese-sisheng) (egg-string-match-charset 'chinese-sisheng str i) - (setq l (match-end 0) + (setq l (egg-string-match-charset-end 'chinese-sisheng str i) j (min j l) lang 'Chinese)) ;; XEmacs has sisheng charset while Emacs has chinese-sisheng @@ -430,7 +430,7 @@ mode, if non-NIL." (car (decompose-composite-char c 'list)))))) (t (egg-string-match-charset cset str i) - (setq j (match-end 0) + (setq j (egg-string-match-charset-end cset str i) lang (egg-charset-to-language cset)))) (if lang (put-text-property i j 'egg-lang lang str)))) diff --git a/egg-edep.el b/egg-edep.el index 47a16c9..fc659f5 100644 --- a/egg-edep.el +++ b/egg-edep.el @@ -84,30 +84,14 @@ (next-single-property-change pos prop object)))) (defun egg-string-match-charset (charset string &optional start) - (let ((cur-ct (category-table)) - category) - (unwind-protect - (progn - (set-category-table (copy-category-table)) - (setq category (get-unused-category)) - (define-category category "") - (modify-category-entry (make-char charset) category) - (string-match (concat "\\c" (list category) "+") string start)) - (set-category-table cur-ct)))) - -(unless (egg-string-match-charset 'japanese-jisx0208 "。") - (defun egg-string-match-charset (charset string &optional start) - (let (min max) - (if (= (charset-chars charset) 94) - (setq min 33 max 126) - (setq min 32 max 127)) - (string-match (if (= (charset-dimension charset) 1) - (concat "[" (list (make-char charset min)) - "-" (list (make-char charset max)) - "]+") - (concat "[" (list (make-char charset min min)) - "-" (list (make-char charset max max)) - "]+")) - string start)))) + (eq charset (char-charset (aref string (or start 0))))) + +(defun egg-string-match-charset-end (charset string &optional start) + (let ((index (or start 0)) + (str-len (length string))) + (while (and (< index str-len) + (eq charset (char-charset (aref string index)))) + (setq index (1+ index))) + index)) (provide 'egg-edep)