(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 <kate@pfu.co.jp>
(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)))
(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))
(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))
(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)
(let ((prop (get-text-property (point) 'intangible)))
(or (eq prop 'its-part-1) (eq prop 'its-part-2))))
\f
-(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")
(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))
(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)))
\f
(require 'its-keydef)