From: morioka Date: Sun, 30 Aug 1998 10:00:02 +0000 (+0000) Subject: egg-980316. X-Git-Tag: egg-980316~1 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0db6050c7bc8d536788b1d424357695375d768e2;p=elisp%2Fegg.git egg-980316. --- diff --git a/ChangeLog b/ChangeLog index e0b6d47..bfab2d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +1998-03-16 NIIBE Yutaka + + CANNA Support. + * egg/canna.el, egg/cannarpc.el: New file. + * Makefile (SRCS): Added. + + * egg-cnv.el (egg-end-conversion): Add argument ABORT. + (egg-decide-bunsetsu): Undo the change of 03-04. + (egg-exit-conversion, egg-abort-conversion): Call egg-end-conversion + last. + + * egg/wnn.el (wnn-end-conversion): Follow the change of + EGG-END-CONVERSION. + * egg/sj3.el (sj3-end-conversion): Likewise. + 1998-03-15 NIIBE Yutaka * Makefile: Add dependencies for its-keydef.elc. @@ -295,7 +310,7 @@ (egg-conversion-map, \C-c): New keybind. (egg-get-previous-bunsetsu): Bug fix. (egg-decide-before-point): New implementation. - (egg-exit-conversion): Use gg-decide-before-point. + (egg-exit-conversion): Use egg-decide-before-point. (egg-abort-conversion): New command. 1998-02-20 NIIBE Yutaka diff --git a/Makefile b/Makefile index 3f655f1..ca1bebd 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,7 @@ SRCS = menudiag.el its.el egg.el \ its/zhuyin.el \ its-keydef.el \ egg-mlh.el egg-cnv.el egg-com.el \ + egg/canna.el egg/cannarpc.el \ egg/sj3.el egg/sj3rpc.el \ egg/wnn.el egg/wnnrpc.el diff --git a/egg-cnv.el b/egg-cnv.el index b85cd04..f9df95d 100644 --- a/egg-cnv.el +++ b/egg-cnv.el @@ -88,7 +88,7 @@ (if (= len (length s)) (list s) (list (substring s 0 len) (substring s len))))) -(defun egg-end-conversion-other-languages (bunsetsu-info-list) +(defun egg-end-conversion-other-languages (bunsetsu-info-list abort) nil) (defun egg-fini-other-languages (language) nil) @@ -129,8 +129,8 @@ (funcall (aref egg-conversion-backend 8) bunsetsu-info candidate-pos)) (defun egg-change-bunsetsu-length (b0 b1 b2 len) (funcall (aref egg-conversion-backend 9) b0 b1 b2 len)) -(defun egg-end-conversion (bunsetsu-info-list) - (funcall (aref egg-conversion-backend 10) bunsetsu-info-list)) +(defun egg-end-conversion (bunsetsu-info-list abort) + (funcall (aref egg-conversion-backend 10) bunsetsu-info-list abort)) (defun egg-start-reverse-conversion (yomi-string language) (egg-set-current-backend language) (if (aref egg-conversion-backend 11) @@ -215,7 +215,7 @@ (egg-start-conversion (buffer-substring-no-properties s e) egg-current-language)) - (error + (error ; XXX: catching all error is BADBADBAD (setq egg-conversion-backend egg-conversion-backend-other-languages bunsetsu-info-list (egg-start-conversion-other-languages (buffer-substring-no-properties s e) @@ -556,6 +556,7 @@ (interactive "p") (egg-reconvert-bunsetsu-internal n 'egg-start-conversion)) +;; XXX: not working. Should change protocol to backend? (defun egg-decide-before-point () (interactive) (let ((inhibit-read-only t) @@ -600,21 +601,62 @@ (delete-region (point) (+ (point) (length egg-conversion-close))) (its-restart source t)))) +(defun egg-decide-bunsetsu (&optional end-marker) + (let ((in-loop t) + p bunsetsu-info-list bl) + (setq p (point)) + (while in-loop + (let ((bl1 (cons (egg-get-bunsetsu-info p) nil))) + (if bl + (setq bl (setcdr bl bl1)) + (setq bunsetsu-info-list (setq bl bl1)))) + (forward-char) + (remove-text-properties p (point) '(face nil + intangible nil + local-map nil + read-only nil + egg-bunsetsu-last nil)) + (setq p (point)) + (if (or (and end-marker (= p end-marker)) + (get-text-property p 'egg-end)) + (setq in-loop nil) + (setq p (1- p)) + (delete-region p (1+ p)))) ; Delete bunsetsu separator + bunsetsu-info-list)) + (defun egg-exit-conversion () (interactive) - (goto-char (next-single-property-change (point) 'egg-end)) - (egg-decide-before-point)) + (let ((inhibit-read-only t) + start bunsetsu-list) + (if (get-text-property (1- (point)) 'egg-start) + (setq start (1- (point))) + (setq start (1- (previous-single-property-change (point) 'egg-start)))) + (goto-char start) + ;; Delete open marker + (delete-region start (+ start (length egg-conversion-open))) + (setq bunsetsu-list (egg-decide-bunsetsu)) + ;; Delete close marker + (delete-region (point) (+ (point) (length egg-conversion-close))) + (egg-end-conversion bunsetsu-list nil) + (egg-do-auto-fill) + (run-hooks 'input-method-after-insert-chunk-hook))) (defun egg-abort-conversion () (interactive) - (let ((inhibit-read-only t) source) - (goto-char (- (if (get-text-property (1- (point)) 'egg-start) - (point) - (previous-single-property-change (point) 'egg-start)) - (length egg-conversion-open))) + (let ((inhibit-read-only t) + start bunsetsu-list source) + (if (get-text-property (1- (point)) 'egg-start) + (setq start (1- (point))) + (setq start (1- (previous-single-property-change (point) 'egg-start)))) + (goto-char start) (setq source (get-text-property (point) 'egg-source)) - (delete-region (point) (+ (next-single-property-change (point) 'egg-end) - (length egg-conversion-close))) + ;; Delete open marker + (delete-region start (+ start (length egg-conversion-open))) + (setq bunsetsu-list (egg-decide-bunsetsu)) + ;; Delete close marker + (delete-region (point) (+ (point) (length egg-conversion-close))) + (egg-end-conversion bunsetsu-list t) + (delete-region start (point)) (its-restart source))) (defun egg-select-candidate () diff --git a/egg/canna.el b/egg/canna.el index c401aa2..845bfd1 100644 --- a/egg/canna.el +++ b/egg/canna.el @@ -29,9 +29,7 @@ ;;; Code: -(require 'egg-edep) - -(defconst canna-support-languages '(Japanese)) +(defconst canna-support-languages '("Japanese")) (eval-when-compile (defmacro CANNA-const (c) @@ -72,7 +70,7 @@ (set-buffer buf) (erase-buffer) (buffer-disable-undo) - (set-buffer-multibyte nil)) + (setq enable-multibyte-characters nil)) (setq result (cannarpc-open proc (user-login-name))) (if (< result 0) (let ((msg (cannarpc-get-error-message (- result)))) diff --git a/egg/sj3.el b/egg/sj3.el index bfa5222..b011f05 100644 --- a/egg/sj3.el +++ b/egg/sj3.el @@ -8,7 +8,7 @@ ;; Author: NIIBE Yutaka ;; Maintainer: NIIBE Yutaka -;; This file will be part of EGG. +;; This file is part of EGG. ;; EGG is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -233,17 +233,17 @@ (setq ret (sj3rpc-open-stdy proc name)) (if (= ret 0) (setq trying nil) - (message "’³Ø’½¬’¥Õ’¥¡’¥¤’¥ë(%s)’¤¬’¤¢’¤ê’¤Þ’¤»’¤ó" name) + (message "’³Ø’½¬’¥Õ’¥¡’¥¤’¥ë(%s)’¤¬’¤¢’¤ê’¤Þ’¤»’¤ó" name) (if (/= ret (SJ3-const FileNotExist)) (error "Fatal1") ; XXX (if (and (y-or-n-p - (format "’³Ø’½¬’¥Õ’¥¡’¥¤’¥ë(%s)’¤¬’¤¢’¤ê’¤Þ’¤»’¤ó’¡£’ºî’¤ê’¤Þ’¤¹’¤«? " + (format "’³Ø’½¬’¥Õ’¥¡’¥¤’¥ë(%s)’¤¬’¤¢’¤ê’¤Þ’¤»’¤ó’¡£’ºî’¤ê’¤Þ’¤¹’¤«? " name)) (sj3rpc-make-directory proc (file-name-directory name)) ;; ignore error (= (sj3rpc-make-stdy proc name) 0)) - (message "’³Ø’½¬’¥Õ’¥¡’¥¤’¥ë(%s)’¤ò’ºî’¤ê’¤Þ’¤·’¤¿" name) + (message "’³Ø’½¬’¥Õ’¥¡’¥¤’¥ë(%s)’¤ò’ºî’¤ê’¤Þ’¤·’¤¿" name) (error "Fatal2"))))))) ; XXX (defun sj3-open-dictionary (proc name passwd) @@ -253,15 +253,15 @@ (setq ret (sj3rpc-open-dictionary proc name passwd)) (if (>= ret 0) (setq trying nil) - (message "’¼­’½ñ’¥Õ’¥¡’¥¤’¥ë(%s)’¤¬’¤¢’¤ê’¤Þ’¤»’¤ó" name) + (message "’¼­’½ñ’¥Õ’¥¡’¥¤’¥ë(%s)’¤¬’¤¢’¤ê’¤Þ’¤»’¤ó" name) (setq ret (- ret)) ; Get error code. (if (/= ret (SJ3-const FileNotExist)) (error "Fatal3 %d" ret) ; XXX (if (and (y-or-n-p - (format "’¼­’½ñ’¥Õ’¥¡’¥¤’¥ë(%s)’¤¬’¤¢’¤ê’¤Þ’¤»’¤ó’¡£’ºî’¤ê’¤Þ’¤¹’¤«? " + (format "’¼­’½ñ’¥Õ’¥¡’¥¤’¥ë(%s)’¤¬’¤¢’¤ê’¤Þ’¤»’¤ó’¡£’ºî’¤ê’¤Þ’¤¹’¤«? " name)) (= (sj3rpc-make-dictionary proc name) 0)) - (message "’¼­’½ñ’¥Õ’¥¡’¥¤’¥ë(%s)’¤ò’ºî’¤ê’¤Þ’¤·’¤¿" name) + (message "’¼­’½ñ’¥Õ’¥¡’¥¤’¥ë(%s)’¤ò’ºî’¤ê’¤Þ’¤·’¤¿" name) (error "Fatal4"))))) ; XXX ret)) @@ -274,22 +274,24 @@ Return the list of bunsetsu." (let ((env (sj3-get-environment))) (sj3rpc-begin env yomi))) -(defun sj3-end-conversion (bunsetsu-list) - (let ((env (sj3bunsetsu-get-env (car bunsetsu-list))) - (l bunsetsu-list) - bunsetsu stdy kugiri-changed) - (while l - (setq bunsetsu (car l)) - (setq l (cdr l)) - (setq stdy (sj3bunsetsu-get-stdy bunsetsu)) - (if stdy - (sj3rpc-bunsetsu-stdy env stdy)) - (if (setq kugiri-changed (sj3bunsetsu-get-kugiri-changed bunsetsu)) - (let ((yomi1 (sj3bunsetsu-get-source bunsetsu)) - (yomi2 (sj3bunsetsu-get-source (car l)))) - (if (/= kugiri-changed (length yomi1)) - (sj3rpc-kugiri-stdy env yomi1 yomi2 - (sj3bunsetsu-get-stdy (car l))))))))) +(defun sj3-end-conversion (bunsetsu-list abort) + (if abort + () + (let ((env (sj3bunsetsu-get-env (car bunsetsu-list))) + (l bunsetsu-list) + bunsetsu stdy kugiri-changed) + (while l + (setq bunsetsu (car l)) + (setq l (cdr l)) + (setq stdy (sj3bunsetsu-get-stdy bunsetsu)) + (if stdy + (sj3rpc-bunsetsu-stdy env stdy)) + (if (setq kugiri-changed (sj3bunsetsu-get-kugiri-changed bunsetsu)) + (let ((yomi1 (sj3bunsetsu-get-source bunsetsu)) + (yomi2 (sj3bunsetsu-get-source (car l)))) + (if (/= kugiri-changed (length yomi1)) + (sj3rpc-kugiri-stdy env yomi1 yomi2 + (sj3bunsetsu-get-stdy (car l)))))))))) (defun sj3-list-candidates (bunsetsu prev-bunsetsu) (let* ((env (sj3bunsetsu-get-env bunsetsu)) diff --git a/egg/wnn.el b/egg/wnn.el index 22822b3..9b4e3e4 100644 --- a/egg/wnn.el +++ b/egg/wnn.el @@ -348,10 +348,12 @@ Return the list of bunsetsu." (concat (wnn-bunsetsu-get-yomi bunsetsu) (wnn-bunsetsu-get-fuzokugo bunsetsu))) -(defun wnn-end-conversion (bunsetsu-info-list) - (let ((env (wnn-bunsetsu-get-env (car bunsetsu-info-list)))) - (wnn-update-frequency env bunsetsu-info-list) - (wnnenv-set-daibunsetsu-info env nil))) +(defun wnn-end-conversion (bunsetsu-info-list abort) + (if abort + () + (let ((env (wnn-bunsetsu-get-env (car bunsetsu-info-list)))) + (wnn-update-frequency env bunsetsu-info-list) + (wnnenv-set-daibunsetsu-info env nil)))) (defvar wnn-sticky-environment-flag nil "*Flag which specifies sticky environment.") diff --git a/leim-list-egg.el b/leim-list-egg.el index 215b9a0..e1e944f 100644 --- a/leim-list-egg.el +++ b/leim-list-egg.el @@ -14,6 +14,11 @@ 'its-select-hiragana) (register-input-method + "japanese-egg-canna" "Japanese" 'egg-activate-canna + "" "Romaji -> Hiragana -> Kanji&Kana" + 'its-select-hiragana) + +(register-input-method "chinese-gb-egg-wnn-py" "Chinese-GB" 'egg-activate-wnn "" "Pinyin -> Simplified Hanzi" 'its-select-pinyin-cn)