diff options
| author | Kenichi Handa | 2003-07-30 06:35:51 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2003-07-30 06:35:51 +0000 |
| commit | 75a304b76ebcfda801c568e5de9ef452e91e1d13 (patch) | |
| tree | 640579b6f653a67c8b88a158760a3376d4f365c6 | |
| parent | b909e366c00ab612a1d3dbfb14e9d9092db4d508 (diff) | |
| download | emacs-75a304b76ebcfda801c568e5de9ef452e91e1d13.tar.gz emacs-75a304b76ebcfda801c568e5de9ef452e91e1d13.zip | |
(quail-indian-update-translation): Adjusted the
behaviour according to the change of quail-translate-key.
| -rw-r--r-- | leim/quail/indian.el | 68 |
1 files changed, 31 insertions, 37 deletions
diff --git a/leim/quail/indian.el b/leim/quail/indian.el index abe2feb93e8..2d2e284844c 100644 --- a/leim/quail/indian.el +++ b/leim/quail/indian.el | |||
| @@ -48,34 +48,41 @@ | |||
| 48 | (defvar quail-indian-update-preceding-char nil) | 48 | (defvar quail-indian-update-preceding-char nil) |
| 49 | (make-variable-frame-local 'quail-indian-update-preceding-char) | 49 | (make-variable-frame-local 'quail-indian-update-preceding-char) |
| 50 | 50 | ||
| 51 | ;;; update function | 51 | ;; Input value :: |
| 52 | 52 | ;; CONTROL-FLAG is integer `n' | |
| 53 | ;; CONTROL-FLAG is integer (n) | ||
| 54 | ;; quail-current-key :: keyboard input. | 53 | ;; quail-current-key :: keyboard input. |
| 55 | ;; Only first n can be translated. | 54 | ;; Only first `n' can be translated. |
| 56 | ;; quail-current-string :: corresonding string. Translated when last | 55 | ;; quail-current-str :: corresonding string. |
| 57 | ;; time CONTROL-FLAG is nil. | 56 | ;; jobs :: (1) put last (len-n) char to unrread-command-event. |
| 58 | ;; todo :: (1) put last (len-n) char to unrread-command-event. | 57 | ;; (2) put translated string to quail-current-str. |
| 59 | ;; (2) put translated string to quail-current-string. | ||
| 60 | ;; | 58 | ;; |
| 61 | ;; CONTROL-FLAG is t (terminate) or nil (proceed the translation) | 59 | ;; CONTROL-FLAG is t (terminate) or nil (proceed the translation) |
| 62 | ;; quail-current-key :: keyboard input. | 60 | ;; quail-current-key :: keyboard input. |
| 63 | ;; quail-current-string :: corresponding string. Created by database. | 61 | ;; quail-current-str :: corresponding string. |
| 64 | ;; todo :: (1) put modified translated string to quail-current-string. | 62 | ;; jobs :: (1) put modified translated string to quail-current-str. |
| 63 | ;; | ||
| 64 | ;; When non-nil value is returned from quail-translation-update-function, | ||
| 65 | ;; the quail-current-str is split to characters and put into event queue, | ||
| 66 | ;; with `compose-last-char' event with composition info at the end. | ||
| 65 | 67 | ||
| 66 | (defun quail-indian-update-translation (control-flag) | 68 | (defun quail-indian-update-translation (control-flag) |
| 67 | ;;(message "input control-flag=%s, string=%s, key=%s" | ||
| 68 | ;; control-flag quail-current-str quail-current-key) | ||
| 69 | ;; make quail-current-str string when possible. | 69 | ;; make quail-current-str string when possible. |
| 70 | (if (char-valid-p quail-current-str) | 70 | (if (char-valid-p quail-current-str) |
| 71 | (setq quail-current-str (char-to-string quail-current-str))) | 71 | (setq quail-current-str (char-to-string quail-current-str))) |
| 72 | ;(message "\n input control-flag=%s, str=%s, key=%s q-ind-upd-prec-char=%s" | ||
| 73 | ; control-flag quail-current-str quail-current-key | ||
| 74 | ; quail-indian-update-preceding-char) | ||
| 72 | ;; reset quail-indian-update-preceding-char if it's initial. | 75 | ;; reset quail-indian-update-preceding-char if it's initial. |
| 73 | (if (= (overlay-start quail-overlay) (overlay-end quail-overlay)) | 76 | (if (= (overlay-start quail-overlay) (overlay-end quail-overlay)) |
| 74 | (setq quail-indian-update-preceding-char nil)) | 77 | (setq quail-indian-update-preceding-char nil)) |
| 75 | ;; set quial-indian-update-preceding-char if appropriate. | 78 | ;; Check the preceding character of the quail region. If the |
| 79 | ;; preceding character can be composed with quail-current-str, then | ||
| 80 | ;; grab that preceding character into the quail-current-str and | ||
| 81 | ;; remove that char from the region. | ||
| 76 | (let* (prec-char-position composition-regexp | 82 | (let* (prec-char-position composition-regexp |
| 77 | prec-char-str candidate-str match-pos match-end) | 83 | prec-char-str candidate-str match-pos match-end) |
| 78 | (when (and quail-current-str | 84 | (when (and quail-current-str |
| 85 | (null quail-indian-update-preceding-char) | ||
| 79 | (null input-method-use-echo-area) | 86 | (null input-method-use-echo-area) |
| 80 | (null input-method-exit-on-first-char) | 87 | (null input-method-exit-on-first-char) |
| 81 | (setq prec-char-position | 88 | (setq prec-char-position |
| @@ -85,7 +92,6 @@ | |||
| 85 | (if prec-char-position | 92 | (if prec-char-position |
| 86 | (caar (elt composition-function-table | 93 | (caar (elt composition-function-table |
| 87 | (char-after prec-char-position))))) | 94 | (char-after prec-char-position))))) |
| 88 | ;; (null quail-indian-update-preceding-char) | ||
| 89 | (setq prec-char-str | 95 | (setq prec-char-str |
| 90 | (buffer-substring prec-char-position | 96 | (buffer-substring prec-char-position |
| 91 | (overlay-start quail-overlay)) | 97 | (overlay-start quail-overlay)) |
| @@ -96,31 +102,19 @@ | |||
| 96 | (setq quail-indian-update-preceding-char prec-char-str) | 102 | (setq quail-indian-update-preceding-char prec-char-str) |
| 97 | (delete-region prec-char-position | 103 | (delete-region prec-char-position |
| 98 | (overlay-start quail-overlay)))) | 104 | (overlay-start quail-overlay)))) |
| 99 | ;; make quail-current-str string when possible. | 105 | (setq quail-current-str |
| 100 | (if (null quail-current-str) | 106 | (indian-compose-string |
| 101 | (setq quail-current-str "")) | 107 | (concat quail-indian-update-preceding-char |
| 102 | ;; set quail-current-str unless control-flag is number. | 108 | quail-current-str))) |
| 103 | (if (numberp control-flag) | 109 | (if (numberp control-flag) |
| 104 | (setq quail-indian-update-preceding-char nil | 110 | (setq unread-command-events |
| 105 | quail-current-str | ||
| 106 | (if (equal quail-current-str "") | ||
| 107 | (substring quail-current-key 0 control-flag) | ||
| 108 | (indian-compose-string quail-current-str)) | ||
| 109 | unread-command-events | ||
| 110 | (string-to-list | 111 | (string-to-list |
| 111 | (substring quail-current-key control-flag))) | 112 | (substring quail-current-key control-flag)))) |
| 112 | (if quail-indian-update-preceding-char | 113 | (when control-flag |
| 113 | (setq quail-current-str | ||
| 114 | (concat quail-indian-update-preceding-char | ||
| 115 | quail-current-str))) | ||
| 116 | (setq quail-current-str | ||
| 117 | (indian-compose-string quail-current-str))) | ||
| 118 | (when (eq t control-flag) | ||
| 119 | ;; reset preceding-char if translation is terminated. | ||
| 120 | (setq quail-indian-update-preceding-char nil)) | 114 | (setq quail-indian-update-preceding-char nil)) |
| 121 | ;; compose to previous char if it looks possible. | 115 | ;(message "output control-flag=%s, str=%s, key=%s q-ind-upd-prec-char=%s" |
| 122 | ;;(message " out control-flag=%s, string=%s, key=%s" | 116 | ; control-flag quail-current-str quail-current-key |
| 123 | ;; control-flag quail-current-str quail-current-key) | 117 | ; quail-indian-update-preceding-char) |
| 124 | control-flag) | 118 | control-flag) |
| 125 | 119 | ||
| 126 | ;;; | 120 | ;;; |