+1998-04-02 NIIBE Yutaka <gniibe@mri.co.jp>
+
+ * 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 <kate@pfu.co.jp>
+
+ 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 <gniibe@mri.co.jp>
+
+ * 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 <gniibe@mri.co.jp>
CANNA Support.
* 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-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 <gniibe@akebono>
;; Maintainer: NIIBE Yutaka <gniibe@mri.co.jp>
;; 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
'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)
(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)
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
(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)
;; KATAYAMA Yoshio <kate@pfu.co.jp> ; Korean, Chinese support.
;; Maintainer: NIIBE Yutaka <gniibe@mri.co.jp>
-;; 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
'progn
result)))
\f
+(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)))
(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)))
;; Maintainer: NIIBE Yutaka <gniibe@mri.co.jp>
;; 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
;;; 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.
(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)))
;; Maintainer: NIIBE Yutaka <gniibe@mri.co.jp>
;; 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
(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
(interactive)
(its-start last-command-char))
\f
+(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)))))))))
+\f
(defun egg-hinshi-select ()
(menudiag-select ; Should generate at initialization time
'(menu "\e$BIJ;lL>\e(B:"
(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)
(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
(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))))
(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)
(setq ret (sj3rpc-open-stdy proc name))
(if (= ret 0)
(setq trying nil)
- (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)
+ (message "\e$B3X=,%U%!%$%k\e(B(%s)\e$B$,$"$j$^$;$s\e(B" name)
(if (/= ret (SJ3-const FileNotExist))
(error "Fatal1") ; XXX
(if (and (y-or-n-p
- (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¤«? "
+ (format "\e$B3X=,%U%!%$%k\e(B(%s)\e$B$,$"$j$^$;$s!#:n$j$^$9$+\e(B? "
name))
(sj3rpc-make-directory proc
(file-name-directory name))
;; ignore error
(= (sj3rpc-make-stdy proc name) 0))
- (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)
+ (message "\e$B3X=,%U%!%$%k\e(B(%s)\e$B$r:n$j$^$7$?\e(B" 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\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)
+ (message "\e$B<-=q%U%!%$%k\e(B(%s)\e$B$,$"$j$^$;$s\e(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 "\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¤«? "
+ (format "\e$B<-=q%U%!%$%k\e(B(%s)\e$B$,$"$j$^$;$s!#:n$j$^$9$+\e(B? "
name))
(= (sj3rpc-make-dictionary proc name) 0))
- (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)
+ (message "\e$B<-=q%U%!%$%k\e(B(%s)\e$B$r:n$j$^$7$?\e(B" name)
(error "Fatal4"))))) ; XXX
ret))
;;
;; Maintainer: NIIBE Yutaka <gniibe@mri.co.jp>
-;; 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
(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")))
'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)
(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))
'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)