From: kate Date: Tue, 24 Feb 1998 06:50:07 +0000 (+0000) Subject: remove temporary its-barf-on-invalid-keyseq binding. X-Git-Tag: egg-980304~2^2~7 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=967338c15046de0c67ebeff7a261b584d98e4a72;p=elisp%2Fegg.git remove temporary its-barf-on-invalid-keyseq binding. avoid altering original string of its-map. gather contiguous same language part. --- diff --git a/ChangeLog b/ChangeLog index 1374cba..d7507a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,8 +6,8 @@ (its-translate-region-internal): its-translation-result's data type is changed to string. - * egg-cnv.el (egg-convert-region): Gather adjacent same language - part. + * egg-cnv.el (egg-convert-region): Gather contiguous same + language part. 1998-02-21 KATAYAMA Yoshio diff --git a/egg-cnv.el b/egg-cnv.el index 8c499b3..92c7593 100644 --- a/egg-cnv.el +++ b/egg-cnv.el @@ -128,9 +128,12 @@ (egg-separate-languages start (point-max)) (goto-char start) (while (< (point) (point-max)) - (setq lang (get-text-property (point) 'egg-lang)) - (setq s (point) - e (next-single-property-change s 'egg-lang nil (point-max))) + (setq lang (get-text-property (point) 'egg-lang) + s (point) + e (point)) + (while (and (< e (point-max)) + (equal lang (get-text-property e 'egg-lang))) + (setq e (next-single-property-change e 'egg-lang nil (point-max)))) (setq bunsetsu-info-list (egg-start-conversion (buffer-substring s e) lang)) (setq contin (< e (point-max))) @@ -146,6 +149,7 @@ (defun egg-separate-languages (start end) (let (lang last-lang last-chinese p l c cset) + ;; 1st pass -- mark undefined Chinese part (goto-char start) (while (< (point) end) (setq p (next-single-property-change (point) 'its-lang nil end)) @@ -169,6 +173,7 @@ (setq p (point)) (forward-char) (put-text-property p (point) 'its-lang (egg-char-to-language c))))) + ;; 2nd pass -- set language property (goto-char start) (while (< (point) end) (setq lang (get-text-property (point) 'its-lang)) diff --git a/its.el b/its.el index 0978ba7..9abea6d 100644 --- a/its.el +++ b/its.el @@ -363,7 +363,6 @@ (defun its-state-machine-keyseq (keyseq emit &optional eol) (let ((i 0) (len (length keyseq)) - (its-barf-on-invalid-keyseq nil) ; temporally disable DING (syl (its-initial-ISYL)) cursor) (while (< i len) @@ -716,21 +715,20 @@ Return last state." (let ((prop (get-text-property (point) 'intangible))) (or (eq prop 'its-part-1) (eq prop 'its-part-2)))) -(defvar its-translation-result nil "") +(defvar its-translation-result "" "") (defun its-ins/del-SYL-batch (newsyl oldsyl) - (let (output) (its-update-latest-SYL newsyl) (if (and newsyl (consp (cdr newsyl)) (not (its-kst-p (its-get-kst/t newsyl)))) - (progn - ;; DSYL - (setq output (its-get-output newsyl)) - (put-text-property 0 (length output) - 'its-lang its-current-language output) - (setq its-translation-result - (cons output its-translation-result)))))) + ;; DSYL + (let ((output (its-get-output newsyl)) + (oldlen (length its-translation-result))) + (setq its-translation-result (concat its-translation-result output)) + (put-text-property oldlen (length its-translation-result) + 'its-lang its-current-language + its-translation-result)))) (defun its-translate-region (start end) (interactive "r") @@ -738,7 +736,7 @@ Return last state." (remove-text-properties start (point) '(its-lang nil))) (defun its-translate-region-internal (start end) - (setq its-translation-result nil) + (setq its-translation-result "") (goto-char start) (let ((i 0) (syl (its-initial-ISYL)) @@ -755,7 +753,7 @@ Return last state." (if (eq syl its-latest-SYL) (its-state-machine syl -1 'its-ins/del-SYL-batch)) (delete-region start end) - (apply 'insert (reverse its-translation-result)))) + (insert its-translation-result))) (require 'its-keydef)