diff options
| author | Kenichi Handa | 2000-07-17 01:22:09 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2000-07-17 01:22:09 +0000 |
| commit | a9fbabdab0b94c7c84e8560dd228c697cf402888 (patch) | |
| tree | 3d7e7623bdbf53c67a70934ffbab47981b36efdc | |
| parent | a45423d8fabea1bfb09b58be3432d07fd12346c5 (diff) | |
| download | emacs-a9fbabdab0b94c7c84e8560dd228c697cf402888.tar.gz emacs-a9fbabdab0b94c7c84e8560dd228c697cf402888.zip | |
(kkc-show-conversion-list-count): Customize it.
(kkc-region): Update kkc-next-count and kkc-prev-count here. Show
the conversion list at first if appropriate.
(kkc-next): Don't update kkc-next-count here.
(kkc-prev): Don't update kkc-prev-count here.
(kkc-show-conversion-list-update): Fix setting up of conversion
list message.
| -rw-r--r-- | lisp/international/kkc.el | 58 |
1 files changed, 39 insertions, 19 deletions
diff --git a/lisp/international/kkc.el b/lisp/international/kkc.el index 291499935df..70c7d501e2a 100644 --- a/lisp/international/kkc.el +++ b/lisp/international/kkc.el | |||
| @@ -131,8 +131,19 @@ This string is shown at mode line when users are in KKC mode.") | |||
| 131 | ;; `kkc-current-conversion'. | 131 | ;; `kkc-current-conversion'. |
| 132 | (defvar kkc-current-conversions-width nil) | 132 | (defvar kkc-current-conversions-width nil) |
| 133 | 133 | ||
| 134 | (defvar kkc-show-conversion-list-count 4 | 134 | (defcustom kkc-show-conversion-list-count 4 |
| 135 | "Count of successive `kkc-next' or `kkc-prev' to show conversion list.") | 135 | "*Count of successive `kkc-next' or `kkc-prev' to show conversion list. |
| 136 | When you type SPC or C-p successively this count while using the input | ||
| 137 | method `japanese', the conversion candidates are shown in the echo | ||
| 138 | area while indicating the current selection by `<N>'." | ||
| 139 | :group 'mule | ||
| 140 | :type 'integer) | ||
| 141 | |||
| 142 | ;; Count of successive invocations of `kkc-next'. | ||
| 143 | (defvar kkc-next-count nil) | ||
| 144 | |||
| 145 | ;; Count of successive invocations of `kkc-prev'. | ||
| 146 | (defvar kkc-prev-count nil) | ||
| 136 | 147 | ||
| 137 | ;; Provided that `kkc-current-key' is [A B C D E F G H I], the current | 148 | ;; Provided that `kkc-current-key' is [A B C D E F G H I], the current |
| 138 | ;; conversion target is [A B C D E F], and the sequence of which | 149 | ;; conversion target is [A B C D E F], and the sequence of which |
| @@ -237,6 +248,10 @@ and the return value is the length of the conversion." | |||
| 237 | first nil)) | 248 | first nil)) |
| 238 | (goto-char to) | 249 | (goto-char to) |
| 239 | (kkc-update-conversion 'all) | 250 | (kkc-update-conversion 'all) |
| 251 | (setq kkc-next-count 1 kkc-prev-count 0) | ||
| 252 | (if (and (>= kkc-next-count kkc-show-conversion-list-count) | ||
| 253 | (>= (length kkc-current-conversions) 3)) | ||
| 254 | (kkc-show-conversion-list-or-next-group)) | ||
| 240 | 255 | ||
| 241 | ;; Then, ask users to select a desirable conversion. | 256 | ;; Then, ask users to select a desirable conversion. |
| 242 | (force-mode-line-update) | 257 | (force-mode-line-update) |
| @@ -249,7 +264,16 @@ and the return value is the length of the conversion." | |||
| 249 | (cmd (lookup-key kkc-keymap keyseq))) | 264 | (cmd (lookup-key kkc-keymap keyseq))) |
| 250 | (if (commandp cmd) | 265 | (if (commandp cmd) |
| 251 | (condition-case err | 266 | (condition-case err |
| 252 | (call-interactively cmd) | 267 | (progn |
| 268 | (cond ((eq cmd 'kkc-next) | ||
| 269 | (setq kkc-next-count (1+ kkc-next-count) | ||
| 270 | kkc-prev-count 0)) | ||
| 271 | ((eq cmd 'kkc-prev) | ||
| 272 | (setq kkc-prev-count (1+ kkc-prev-count) | ||
| 273 | kkc-next-count 0)) | ||
| 274 | (t | ||
| 275 | (setq kkc-next-count 0 kkc-prev-count 0))) | ||
| 276 | (call-interactively cmd)) | ||
| 253 | (kkc-error (message "%s" (cdr err)) (beep))) | 277 | (kkc-error (message "%s" (cdr err)) (beep))) |
| 254 | ;; KEYSEQ is not defined in KKC keymap. | 278 | ;; KEYSEQ is not defined in KKC keymap. |
| 255 | ;; Let's put the event back. | 279 | ;; Let's put the event back. |
| @@ -288,15 +312,9 @@ and the return value is the length of the conversion." | |||
| 288 | (delete-region (point) (overlay-end kkc-overlay-tail)) | 312 | (delete-region (point) (overlay-end kkc-overlay-tail)) |
| 289 | (kkc-terminate)) | 313 | (kkc-terminate)) |
| 290 | 314 | ||
| 291 | ;; Count of successive invocations of `kkc-next'. | ||
| 292 | (defvar kkc-next-count nil) | ||
| 293 | |||
| 294 | (defun kkc-next () | 315 | (defun kkc-next () |
| 295 | "Select the next candidate of conversion." | 316 | "Select the next candidate of conversion." |
| 296 | (interactive) | 317 | (interactive) |
| 297 | (if (eq this-command last-command) | ||
| 298 | (setq kkc-next-count (1+ kkc-next-count)) | ||
| 299 | (setq kkc-next-count 1)) | ||
| 300 | (let ((idx (1+ (car kkc-current-conversions)))) | 318 | (let ((idx (1+ (car kkc-current-conversions)))) |
| 301 | (if (< idx 0) | 319 | (if (< idx 0) |
| 302 | (setq idx 1)) | 320 | (setq idx 1)) |
| @@ -313,15 +331,9 @@ and the return value is the length of the conversion." | |||
| 313 | (kkc-show-conversion-list-update)) | 331 | (kkc-show-conversion-list-update)) |
| 314 | (kkc-update-conversion))) | 332 | (kkc-update-conversion))) |
| 315 | 333 | ||
| 316 | ;; Count of successive invocations of `kkc-next'. | ||
| 317 | (defvar kkc-prev-count nil) | ||
| 318 | |||
| 319 | (defun kkc-prev () | 334 | (defun kkc-prev () |
| 320 | "Select the previous candidate of conversion." | 335 | "Select the previous candidate of conversion." |
| 321 | (interactive) | 336 | (interactive) |
| 322 | (if (eq this-command last-command) | ||
| 323 | (setq kkc-prev-count (1+ kkc-prev-count)) | ||
| 324 | (setq kkc-prev-count 1)) | ||
| 325 | (let ((idx (1- (car kkc-current-conversions)))) | 337 | (let ((idx (1- (car kkc-current-conversions)))) |
| 326 | (if (< idx 0) | 338 | (if (< idx 0) |
| 327 | (setq idx (1- (length kkc-current-conversions)))) | 339 | (setq idx (1- (length kkc-current-conversions)))) |
| @@ -541,7 +553,9 @@ and change the current conversion to the last one in the group." | |||
| 541 | (idx this-idx) | 553 | (idx this-idx) |
| 542 | (max-items (length kkc-show-conversion-list-index-chars)) | 554 | (max-items (length kkc-show-conversion-list-index-chars)) |
| 543 | l) | 555 | l) |
| 544 | (while (< idx current-idx) | 556 | ;; Set THIS-IDX to the first index of conversion to be shown |
| 557 | ;; in MSG, and reflect it in kkc-current-conversions-width. | ||
| 558 | (while (<= idx current-idx) | ||
| 545 | (if (and (<= (+ width (aref width-table idx)) max-width) | 559 | (if (and (<= (+ width (aref width-table idx)) max-width) |
| 546 | (< (- idx this-idx) max-items)) | 560 | (< (- idx this-idx) max-items)) |
| 547 | (setq width (+ width (aref width-table idx))) | 561 | (setq width (+ width (aref width-table idx))) |
| @@ -549,6 +563,9 @@ and change the current conversion to the last one in the group." | |||
| 549 | (setq idx (1+ idx) | 563 | (setq idx (1+ idx) |
| 550 | l (cdr l))) | 564 | l (cdr l))) |
| 551 | (aset first-slot 0 this-idx) | 565 | (aset first-slot 0 this-idx) |
| 566 | ;; Set NEXT-IDX to the next index of the last conversion | ||
| 567 | ;; shown in MSG, and reflect it in | ||
| 568 | ;; kkc-current-conversions-width. | ||
| 552 | (while (and (< idx len) | 569 | (while (and (< idx len) |
| 553 | (<= (+ width (aref width-table idx)) max-width) | 570 | (<= (+ width (aref width-table idx)) max-width) |
| 554 | (< (- idx this-idx) max-items)) | 571 | (< (- idx this-idx) max-items)) |
| @@ -557,10 +574,13 @@ and change the current conversion to the last one in the group." | |||
| 557 | l (cdr l))) | 574 | l (cdr l))) |
| 558 | (aset first-slot 1 (setq next-idx idx)) | 575 | (aset first-slot 1 (setq next-idx idx)) |
| 559 | (setq l (nthcdr this-idx kkc-current-conversions)) | 576 | (setq l (nthcdr this-idx kkc-current-conversions)) |
| 560 | (setq msg "") | 577 | (setq msg (format " %c %s" |
| 561 | (setq idx this-idx) | 578 | (aref kkc-show-conversion-list-index-chars 0) |
| 579 | (car l)) | ||
| 580 | idx (1+ this-idx) | ||
| 581 | l (cdr l)) | ||
| 562 | (while (< idx next-idx) | 582 | (while (< idx next-idx) |
| 563 | (setq msg (format "%s %c %s " | 583 | (setq msg (format "%s %c %s" |
| 564 | msg | 584 | msg |
| 565 | (aref kkc-show-conversion-list-index-chars | 585 | (aref kkc-show-conversion-list-index-chars |
| 566 | (- idx this-idx)) | 586 | (- idx this-idx)) |