+1998-03-16 NIIBE Yutaka <gniibe@mri.co.jp>
+
+ 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 <gniibe@mri.co.jp>
* Makefile: Add dependencies for its-keydef.elc.
(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 <gniibe@akebono>
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
(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)
(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)
(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)
(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)
(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 ()
;;; Code:
-(require 'egg-edep)
-
-(defconst canna-support-languages '(Japanese))
+(defconst canna-support-languages '("Japanese"))
(eval-when-compile
(defmacro CANNA-const (c)
(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))))
;; Author: NIIBE Yutaka <gniibe@mri.co.jp>
;; Maintainer: NIIBE Yutaka <gniibe@mri.co.jp>
-;; 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
(setq ret (sj3rpc-open-stdy proc name))
(if (= ret 0)
(setq trying nil)
- (message "\92³Ø\92½¬\92¥Õ\92¥¡\92¥¤\92¥ë(%s)\92¤¬\92¤¢\92¤ê\92¤Þ\92¤»\92¤ó" name)
+ (message "\92\81³Ø\92\81½¬\92\81¥Õ\92\81¥¡\92\81¥¤\92\81¥ë(%s)\92\81¤¬\92\81¤¢\92\81¤ê\92\81¤Þ\92\81¤»\92\81¤ó" name)
(if (/= ret (SJ3-const FileNotExist))
(error "Fatal1") ; XXX
(if (and (y-or-n-p
- (format "\92³Ø\92½¬\92¥Õ\92¥¡\92¥¤\92¥ë(%s)\92¤¬\92¤¢\92¤ê\92¤Þ\92¤»\92¤ó\92¡£\92ºî\92¤ê\92¤Þ\92¤¹\92¤«? "
+ (format "\92\81³Ø\92\81½¬\92\81¥Õ\92\81¥¡\92\81¥¤\92\81¥ë(%s)\92\81¤¬\92\81¤¢\92\81¤ê\92\81¤Þ\92\81¤»\92\81¤ó\92\81¡£\92\81ºî\92\81¤ê\92\81¤Þ\92\81¤¹\92\81¤«? "
name))
(sj3rpc-make-directory proc
(file-name-directory name))
;; ignore error
(= (sj3rpc-make-stdy proc name) 0))
- (message "\92³Ø\92½¬\92¥Õ\92¥¡\92¥¤\92¥ë(%s)\92¤ò\92ºî\92¤ê\92¤Þ\92¤·\92¤¿" name)
+ (message "\92\81³Ø\92\81½¬\92\81¥Õ\92\81¥¡\92\81¥¤\92\81¥ë(%s)\92\81¤ò\92\81ºî\92\81¤ê\92\81¤Þ\92\81¤·\92\81¤¿" name)
(error "Fatal2"))))))) ; XXX
(defun sj3-open-dictionary (proc name passwd)
(setq ret (sj3rpc-open-dictionary proc name passwd))
(if (>= ret 0)
(setq trying nil)
- (message "\92¼\92½ñ\92¥Õ\92¥¡\92¥¤\92¥ë(%s)\92¤¬\92¤¢\92¤ê\92¤Þ\92¤»\92¤ó" name)
+ (message "\92\81¼\92\81½ñ\92\81¥Õ\92\81¥¡\92\81¥¤\92\81¥ë(%s)\92\81¤¬\92\81¤¢\92\81¤ê\92\81¤Þ\92\81¤»\92\81¤ó" name)
(setq ret (- ret)) ; Get error code.
(if (/= ret (SJ3-const FileNotExist))
(error "Fatal3 %d" ret) ; XXX
(if (and (y-or-n-p
- (format "\92¼\92½ñ\92¥Õ\92¥¡\92¥¤\92¥ë(%s)\92¤¬\92¤¢\92¤ê\92¤Þ\92¤»\92¤ó\92¡£\92ºî\92¤ê\92¤Þ\92¤¹\92¤«? "
+ (format "\92\81¼\92\81½ñ\92\81¥Õ\92\81¥¡\92\81¥¤\92\81¥ë(%s)\92\81¤¬\92\81¤¢\92\81¤ê\92\81¤Þ\92\81¤»\92\81¤ó\92\81¡£\92\81ºî\92\81¤ê\92\81¤Þ\92\81¤¹\92\81¤«? "
name))
(= (sj3rpc-make-dictionary proc name) 0))
- (message "\92¼\92½ñ\92¥Õ\92¥¡\92¥¤\92¥ë(%s)\92¤ò\92ºî\92¤ê\92¤Þ\92¤·\92¤¿" name)
+ (message "\92\81¼\92\81½ñ\92\81¥Õ\92\81¥¡\92\81¥¤\92\81¥ë(%s)\92\81¤ò\92\81ºî\92\81¤ê\92\81¤Þ\92\81¤·\92\81¤¿" name)
(error "Fatal4"))))) ; XXX
ret))
(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))
(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.")
'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)