]> git.eshelyaron.com Git - emacs.git/commitdiff
(kkc-region): Unwind-protect the conversion
authorKenichi Handa <handa@m17n.org>
Sat, 25 Jul 1998 04:23:13 +0000 (04:23 +0000)
committerKenichi Handa <handa@m17n.org>
Sat, 25 Jul 1998 04:23:13 +0000 (04:23 +0000)
process.
(kkc-show-conversion-list-update): Pay attention to the length of
kkc-show-conversion-list-index-chars.

lisp/international/kkc.el

index ba9ec6f910f1b910af5ca223bca98436be63348d..6731d21be654b3c3e706342721f3ce2ec60b3d84 100644 (file)
@@ -215,28 +215,30 @@ and the return value is the length of the conversion."
     (goto-char to)
     (kkc-update-conversion 'all))
 
-  ;; Then, ask users to selecte a desirable conversoin.
-  (let ((current-input-method-title kkc-input-method-title)
-       (input-method-function nil))
-    (force-mode-line-update)
-    (setq kkc-converting t)
-    (while kkc-converting
-      (let* ((echo-keystrokes 0)
-            (keyseq (read-key-sequence nil))
-            (cmd (lookup-key kkc-keymap keyseq)))
-       (if (commandp cmd)
-           (condition-case err
-               (call-interactively cmd)
-             (kkc-error (message "%s" (cdr err)) (beep)))
-         ;; KEYSEQ is not defined in KKC keymap.
-         ;; Let's put the event back.
-         (setq unread-input-method-events
-               (append (string-to-list keyseq) unread-input-method-events))
-         (kkc-terminate)))))
-
-  (force-mode-line-update)
-  (goto-char (overlay-end kkc-overlay-tail))
-  (prog1 (- (overlay-start kkc-overlay-head) from)
+  ;; Then, ask users to selecte a desirable conversion.
+  (unwind-protect
+      (let ((current-input-method-title kkc-input-method-title)
+           (input-method-function nil))
+       (force-mode-line-update)
+       (setq kkc-converting t)
+       (while kkc-converting
+         (let* ((echo-keystrokes 0)
+                (keyseq (read-key-sequence nil))
+                (cmd (lookup-key kkc-keymap keyseq)))
+           (if (commandp cmd)
+               (condition-case err
+                   (call-interactively cmd)
+                 (kkc-error (message "%s" (cdr err)) (beep)))
+             ;; KEYSEQ is not defined in KKC keymap.
+             ;; Let's put the event back.
+             (setq unread-input-method-events
+                   (append (string-to-list keyseq)
+                           unread-input-method-events))
+             (kkc-terminate))))
+
+       (force-mode-line-update)
+       (goto-char (overlay-end kkc-overlay-tail))
+       (- (overlay-start kkc-overlay-head) from))
     (delete-overlay kkc-overlay-head)
     (delete-overlay kkc-overlay-tail)))
 
@@ -496,16 +498,19 @@ and change the current conversion to the last one in the group."
              (width-table kkc-current-conversions-width)
              (width 0)
              (idx this-idx)
+             (max-items (length kkc-show-conversion-list-index-chars))
              l)
          (while (< idx current-idx)
-           (if (<= (+ width (aref width-table idx)) max-width)
+           (if (and (<= (+ width (aref width-table idx)) max-width)
+                    (< (- idx this-idx) max-items))
                (setq width (+ width (aref width-table idx)))
              (setq this-idx idx width (aref width-table idx)))
            (setq idx (1+ idx)
                  l (cdr l)))
          (aset first-slot 0 this-idx)
          (while (and (< idx len)
-                     (<= (+ width (aref width-table idx)) max-width))
+                     (<= (+ width (aref width-table idx)) max-width)
+                     (< (- idx this-idx) max-items))
            (setq width (+ width (aref width-table idx))
                  idx (1+ idx)
                  l (cdr l)))