From: morioka Date: Sun, 30 Aug 1998 12:03:30 +0000 (+0000) Subject: Sync up with egg-980404. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=63c6f361251f5127e780b51c39e2df3e1fd98ac1;p=elisp%2Fegg.git Sync up with egg-980404. --- diff --git a/ChangeLog b/ChangeLog index bfab2d2..0b00d91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +1998-04-02 NIIBE Yutaka + + * egg-com.el (comm-unpack-u16-string): Call string-as-multibyte. + (comm-unpack-mb-string): Likewise. + + * egg.el (set-buffer-multibyte): Function for Emacs 20.2. + + * egg/wnn.el (wnn-open): Call set-buffer-multibyte. + * egg/sj3.el (sj3-open): Ditto. + * egg/canna.el (canna-open): Ditto. + +1998-04-02 KATAYAMA Yoshio + + Implement hilight. + * egg.el (egg-mark-list, egg-suppress-marking): New Variables. + (egg-set-face, egg-mark-modification, egg-redraw-face): New + Functions. + * its.el (its-buffer-ins/del-SYL): Call egg-set-face. + (its-setup-yanked-portion): Likewise. + * egg-cnv.el (egg-insert-bunsetsu): Call egg-set-face. + + * egg.el (egg-mode): set default backend. + * egg-mlh.el (mlh-space-bar-backward-henkan): activate input + method. + +1998-04-02 NIIBE Yutaka + + * egg-cnv.el (egg-decide-bunsetsu): Undo changes of 03-16. + (egg-abort-conversion): Call egg-end-conversion. + (egg-decide-before-point): Call egg-end-conversion widh ABORT=NIL. + 1998-03-16 NIIBE Yutaka CANNA Support. @@ -5,9 +36,6 @@ * 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. @@ -310,7 +338,7 @@ (egg-conversion-map, \C-c): New keybind. (egg-get-previous-bunsetsu): Bug fix. (egg-decide-before-point): New implementation. - (egg-exit-conversion): Use egg-decide-before-point. + (egg-exit-conversion): Use gg-decide-before-point. (egg-abort-conversion): New command. 1998-02-20 NIIBE Yutaka diff --git a/egg-cnv.el b/egg-cnv.el index f9df95d..bd947dc 100644 --- a/egg-cnv.el +++ b/egg-cnv.el @@ -9,7 +9,7 @@ ;; Maintainer: NIIBE Yutaka ;; Keywords: mule, multilingual, input method -;; This file will be part of GNU Emacs (in future). +;; 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 @@ -376,7 +376,7 @@ 'egg-bunsetsu-last last 'local-map egg-conversion-map)) (if egg-conversion-face - (put-text-property p p1 'face (egg-get-conversion-face))))) + (egg-set-face p p1 (egg-get-conversion-face))))) (defun egg-insert-bunsetsu-list (bunsetsu-info-list &optional last) (let ((l bunsetsu-info-list) @@ -556,7 +556,6 @@ (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) @@ -574,13 +573,13 @@ bl (setcdr bl (list (egg-get-bunsetsu-info (point))))) (if (get-text-property (point) 'egg-bunsetsu-last) (progn - (egg-end-conversion (cdr bunsetsu-list)) + (egg-end-conversion (cdr bunsetsu-list) nil) (setq bunsetsu-list (setq bl (list nil))))) (setq p (point)) (forward-char) (set-text-properties p (point) nil))) (if (cdr bunsetsu-list) - (egg-end-conversion (cdr bunsetsu-list))) + (egg-end-conversion (cdr bunsetsu-list) nil)) (if (get-text-property (point) 'egg-end) (progn ;; delete close marker @@ -601,45 +600,10 @@ (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) - (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))) + (goto-char (next-single-property-change (point) 'egg-end)) + (egg-decide-before-point)) (defun egg-abort-conversion () (interactive) diff --git a/egg-com.el b/egg-com.el index a45871f..72d8045 100644 --- a/egg-com.el +++ b/egg-com.el @@ -10,7 +10,7 @@ ;; KATAYAMA Yoshio ; Korean, Chinese support. ;; Maintainer: NIIBE Yutaka -;; This file will be part of GNU Emacs (in future). +;; 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 @@ -689,6 +689,10 @@ v means 8-bit vector." 'progn result))) +(if (not (fboundp 'string-as-multibyte)) + (defsubst string-as-multibyte (str) + str)) + ;; Do not move the point, leave it where it was. (defun comm-accept-process-output (proc) (let ((p (point))) @@ -744,20 +748,22 @@ v means 8-bit vector." (let ((start (point))) (while (not (search-forward "\0\0" nil t)) (comm-accept-process-output proc)) - (set s (buffer-substring start - (+ start - (decode-coding-region start (- (point) 2) - egg-fixed-euc)))))) + (set s (string-as-multibyte + (buffer-substring start + (+ start + (decode-coding-region start (- (point) 2) + egg-fixed-euc))))))) ;;; XXX should support other conversion (euc-kr, cns) (defsubst comm-unpack-mb-string (proc s) (let ((start (point))) (while (not (search-forward "\0" nil t)) (comm-accept-process-output proc)) - (set s (buffer-substring start - (+ start - (decode-coding-region start (- (point) 1) - egg-mb-euc)))))) + (set s (string-as-multibyte + (buffer-substring start + (+ start + (decode-coding-region start (- (point) 1) + egg-mb-euc))))))) (defsubst comm-unpack-u8-string (proc s) (let ((start (point))) diff --git a/egg-mlh.el b/egg-mlh.el index a520acf..36ad108 100644 --- a/egg-mlh.el +++ b/egg-mlh.el @@ -10,7 +10,7 @@ ;; Maintainer: NIIBE Yutaka ;; Keywords: mule, multilingual, input method -;; This file will be part of GNU Emacs (in future). +;; 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 @@ -33,6 +33,8 @@ ;;; Code: +(defvar mlh-default-backend "wnn") + (defun mlh-space-bar-backward-henkan () "If the character preceding point is / (slash), Do `mlh-backward-henkan'. Then, invoke appropriate conversion, if needed. @@ -41,7 +43,12 @@ Or else, execute command that space-bar invokes usually." (let ((henkan-begin nil) (inhibit-henkan t) (its-disable-special-action t)) - (its-select-hiragana) ;; force to Japanese + (if (null (assoc "Japanese" egg-conversion-backend-alist)) + (progn + (setq egg-mode-preference nil) + (activate-input-method (concat "japanese-egg-" mlh-default-backend))) + ;; force to Japanese + (its-select-hiragana)) (mlh-backward-henkan) (if henkan-begin (if (or inhibit-henkan (= henkan-begin (point))) diff --git a/egg.el b/egg.el index a88bcf2..caec255 100644 --- a/egg.el +++ b/egg.el @@ -9,7 +9,7 @@ ;; Maintainer: NIIBE Yutaka ;; Keywords: mule, multilingual, input method -;; This file will be part of GNU Emacs (in future). +;; 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 @@ -56,9 +56,9 @@ (force-mode-line-update)) ;; Turn on (if (null (string= (car arg) egg-last-method-name)) - (progn + (let ((backend egg-conversion-backend)) (funcall (nth 1 arg)) - (egg-set-conversion-backend nil (list its-current-language) t) + (egg-set-conversion-backend backend (list its-current-language) t) (setq egg-default-language its-current-language))) (setq egg-last-method-name (car arg)) (use-local-map (if egg-mode-preference @@ -92,6 +92,85 @@ (interactive) (its-start last-command-char)) +(defvar egg-mark-list nil) +(defvar egg-suppress-marking nil) + +(defun egg-set-face (beg eng face) + (add-text-properties beg eng + (list 'face face + 'egg-face face + 'modification-hooks '(egg-mark-modification)))) + +(defun egg-mark-modification (beg end) + (if (and (null egg-suppress-marking) + (or (get-text-property beg 'egg-face) + (setq beg (next-single-property-change beg 'egg-face))) + (or (get-text-property (1- end) 'egg-face) + (setq end (previous-single-property-change end 'egg-face))) + (< beg end)) + (let ((list egg-mark-list) + (found 0) + pair mb me b e) + (add-hook 'post-command-hook 'egg-redraw-face t) + (setq list egg-mark-list) + (while (and list (< found 2)) + (setq pair (car list) + list (cdr list) + mb (car pair) + me (cdr pair) + b (marker-position mb) + e (marker-position me)) + (cond + ;; no overwrapping -- SKIP + ((or (null (eq (marker-buffer mb) (current-buffer))) + (or (> beg e) (< end b)))) + ;; completely included + ((and (>= beg b) (<= end e)) + (setq found 3)) + ;; partially overwrapping + (t + (set-marker mb nil) + (set-marker me nil) + (setq egg-mark-list (delete pair egg-mark-list) + beg (min beg b) + end (max end e) + found (1+ found))))) + (if (< found 3) + (progn + (setq b (make-marker) + e (make-marker) + egg-mark-list (cons (cons b e) egg-mark-list)) + (set-marker b beg) + (set-marker e end)))))) + +(defun egg-redraw-face () + (let ((inhibit-read-only t) + (egg-suppress-marking t) + (list egg-mark-list) + mb me b e p) + (setq egg-mark-list nil) + (remove-hook 'post-command-hook 'egg-redraw-face) + (save-excursion + (while list + (setq mb (car (car list)) + me (cdr (car list)) + list (cdr list)) + (when (marker-buffer mb) + (set-buffer (marker-buffer mb)) + (let ((before-change-functions nil) (after-change-functions nil)) + (save-restriction + (widen) + (setq b (max mb (point-min)) + e (min me (point-max))) + (set-marker mb nil) + (set-marker me nil) + (while (< b e) + (if (null (get-text-property b 'egg-face)) + (setq b (next-single-property-change b 'egg-face nil e))) + (setq p (next-single-property-change b 'egg-face nil e)) + (put-text-property b p 'face (get-text-property b 'egg-face)) + (setq b p))))))))) + (defun egg-hinshi-select () (menudiag-select ; Should generate at initialization time '(menu "$BIJ;lL>(B:" @@ -163,17 +242,6 @@ (defgroup egg nil "Tamagotchy --- EGG Versio 4.0") -;;(load-library "its/hira") -;;(setq-default its-current-map its-hira-map) - -;;(load-library "egg/wnn") -;;(load-library "egg/wnnrpc") -;;(setq egg-conversion-backend wnn-conversion-backend) - -;;(load-library "egg/sj3rpc") -;;(load-library "egg/sj3") -;;(setq egg-conversion-backend sj3-conversion-backend) - (defvar egg-support-languages nil) (defun egg-set-support-languages (langs) @@ -186,6 +254,10 @@ (defun egg-kill-emacs-function () (egg-finalize-backend)) +(if (not (fboundp 'set-buffer-multibyte)) +(defun set-buffer-multibyte (flag) + (setq enable-multibyte-characters flag))) + (provide 'egg) ;;; egg.el ends here diff --git a/egg/canna.el b/egg/canna.el index 845bfd1..736302d 100644 --- a/egg/canna.el +++ b/egg/canna.el @@ -70,7 +70,7 @@ (set-buffer buf) (erase-buffer) (buffer-disable-undo) - (setq enable-multibyte-characters nil)) + (set-buffer-multibyte 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 b011f05..33abd34 100644 --- a/egg/sj3.el +++ b/egg/sj3.el @@ -73,7 +73,7 @@ (set-buffer buf) (erase-buffer) (buffer-disable-undo) - (setq enable-multibyte-characters nil)) + (set-buffer-multibyte nil)) ;; Initialize dictionaries (setq sj3-sys-dict-list nil) (setq sj3-user-dict-list nil) @@ -233,17 +233,17 @@ (setq ret (sj3rpc-open-stdy proc name)) (if (= ret 0) (setq trying nil) - (message "’³Ø’½¬’¥Õ’¥¡’¥¤’¥ë(%s)’¤¬’¤¢’¤ê’¤Þ’¤»’¤ó" name) + (message "$B3X=,%U%!%$%k(B(%s)$B$,$"$j$^$;$s(B" name) (if (/= ret (SJ3-const FileNotExist)) (error "Fatal1") ; XXX (if (and (y-or-n-p - (format "’³Ø’½¬’¥Õ’¥¡’¥¤’¥ë(%s)’¤¬’¤¢’¤ê’¤Þ’¤»’¤ó’¡£’ºî’¤ê’¤Þ’¤¹’¤«? " + (format "$B3X=,%U%!%$%k(B(%s)$B$,$"$j$^$;$s!#:n$j$^$9$+(B? " name)) (sj3rpc-make-directory proc (file-name-directory name)) ;; ignore error (= (sj3rpc-make-stdy proc name) 0)) - (message "’³Ø’½¬’¥Õ’¥¡’¥¤’¥ë(%s)’¤ò’ºî’¤ê’¤Þ’¤·’¤¿" name) + (message "$B3X=,%U%!%$%k(B(%s)$B$r:n$j$^$7$?(B" 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 "$B<-=q%U%!%$%k(B(%s)$B$,$"$j$^$;$s(B" 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 "$B<-=q%U%!%$%k(B(%s)$B$,$"$j$^$;$s!#:n$j$^$9$+(B? " name)) (= (sj3rpc-make-dictionary proc name) 0)) - (message "’¼­’½ñ’¥Õ’¥¡’¥¤’¥ë(%s)’¤ò’ºî’¤ê’¤Þ’¤·’¤¿" name) + (message "$B<-=q%U%!%$%k(B(%s)$B$r:n$j$^$7$?(B" name) (error "Fatal4"))))) ; XXX ret)) diff --git a/egg/wnn.el b/egg/wnn.el index 9b4e3e4..4ada308 100644 --- a/egg/wnn.el +++ b/egg/wnn.el @@ -10,7 +10,7 @@ ;; ;; Maintainer: NIIBE Yutaka -;; This file will be part of EGG (in future). +;; 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 @@ -415,8 +415,8 @@ Return the list of bunsetsu." (set-buffer buf) (erase-buffer) (buffer-disable-undo) - (setq enable-multibyte-characters nil - egg-fixed-euc (wnn-server-coding-system server-info))) + (setq egg-fixed-euc (wnn-server-coding-system server-info)) + (set-buffer-multibyte nil)) (cond ((null hostname-list) (setq hostname-list '("localhost"))) diff --git a/its.el b/its.el index 89c5bd2..4aff32b 100644 --- a/its.el +++ b/its.el @@ -470,7 +470,7 @@ 'read-only t 'intangible 'its-part-1)) (if its-fence-face - (put-text-property p (point) 'face (its-get-fence-face))) + (egg-set-face p (point) (its-get-fence-face))) (its-set-cursor-status cursor)))) (defun its-buffer-delete-SYL (syl) @@ -936,7 +936,7 @@ Return last state." (put-text-property p (point) 'its-syl (cons syl syl)) (if its-fence-face (let ((its-current-language (get-text-property p 'egg-lang))) - (put-text-property p (point) 'face (its-get-fence-face))))) + (egg-set-face p (point) (its-get-fence-face))))) (if yank-before (add-text-properties start end '(read-only t intangible its-part-1)) (add-text-properties start end '(read-only t intangible its-part-2)) diff --git a/leim-list-egg.el b/leim-list-egg.el index e1e944f..215b9a0 100644 --- a/leim-list-egg.el +++ b/leim-list-egg.el @@ -14,11 +14,6 @@ '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)