/[emacs]/emacs/lisp/international/quail.el
ViewVC logotype

Diff of /emacs/lisp/international/quail.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.127 by handa, Wed Mar 12 02:37:07 2003 UTC revision 1.128 by handa, Fri Apr 11 03:58:00 2003 UTC
# Line 66  See the documentation of `quail-package- Line 66  See the documentation of `quail-package-
66  (make-variable-buffer-local 'quail-current-package)  (make-variable-buffer-local 'quail-current-package)
67  (put 'quail-current-package 'permanent-local t)  (put 'quail-current-package 'permanent-local t)
68    
69  ;; Quail uses the following two buffers to assist users.  ;; Quail uses the following variables to assist users.
70  ;; A buffer to show available key sequence or translation list.  ;; A string containing available key sequences or translation list.
71  (defvar quail-guidance-buf nil)  (defvar quail-guidance-str nil)
72  ;; A buffer to show completion list of the current key sequence.  ;; A buffer to show completion list of the current key sequence.
73  (defvar quail-completion-buf nil)  (defvar quail-completion-buf nil)
74    ;; We may display the guidance string in a buffer on a one-line frame.
75    (defvar quail-guidance-buf nil)
76    (defvar quail-guidance-frame nil)
77    
78  ;; Each buffer in which Quail is activated should use different  ;; Each buffer in which Quail is activated should use different
79  ;; guidance buffers.  ;; guidance string.
80  (make-variable-buffer-local 'quail-guidance-buf)  (make-variable-buffer-local 'quail-guidance-str)
81  (put 'quail-guidance-buf 'permanent-local t)  (put 'quail-guidance-str 'permanent-local t)
   
 ;; A main window showing Quail guidance buffer.  
 (defvar quail-guidance-win nil)  
 (make-variable-buffer-local 'quail-guidance-win)  
82    
83  (defvar quail-overlay nil  (defvar quail-overlay nil
84    "Overlay which covers the current translation region of Quail.")    "Overlay which covers the current translation region of Quail.")
# Line 514  non-Quail commands." Line 513  non-Quail commands."
513    (let ((pos (point)))    (let ((pos (point)))
514      (if (overlayp quail-overlay)      (if (overlayp quail-overlay)
515          (move-overlay quail-overlay pos pos)          (move-overlay quail-overlay pos pos)
516        (setq quail-overlay (make-overlay pos pos nil nil t))        (setq quail-overlay (make-overlay pos pos))
517        (if input-method-highlight-flag        (if input-method-highlight-flag
518            (overlay-put quail-overlay 'face 'underline))            (overlay-put quail-overlay 'face 'underline))
519        (let ((l (quail-overlay-plist)))        (let ((l (quail-overlay-plist)))
# Line 525  non-Quail commands." Line 524  non-Quail commands."
524          (if (overlayp quail-conv-overlay)          (if (overlayp quail-conv-overlay)
525              (if (not (overlay-start quail-conv-overlay))              (if (not (overlay-start quail-conv-overlay))
526                  (move-overlay quail-conv-overlay pos pos))                  (move-overlay quail-conv-overlay pos pos))
527            (setq quail-conv-overlay (make-overlay pos pos nil nil t))            (setq quail-conv-overlay (make-overlay pos pos))
528            (if input-method-highlight-flag            (if input-method-highlight-flag
529                (overlay-put quail-conv-overlay 'face 'underline))))))                (overlay-put quail-conv-overlay 'face 'underline))))))
530    
# Line 536  non-Quail commands." Line 535  non-Quail commands."
535    (if (and (overlayp quail-conv-overlay) (overlay-start quail-conv-overlay))    (if (and (overlayp quail-conv-overlay) (overlay-start quail-conv-overlay))
536        (delete-overlay quail-conv-overlay)))        (delete-overlay quail-conv-overlay)))
537    
 ;; Kill Quail guidance buffer.  Set in kill-buffer-hook.  
 (defun quail-kill-guidance-buf ()  
   (if (buffer-live-p quail-guidance-buf)  
       (kill-buffer quail-guidance-buf)))  
   
538  (defun quail-inactivate ()  (defun quail-inactivate ()
539    "Inactivate Quail input method.    "Inactivate Quail input method.
540    
# Line 562  While this input method is active, the v Line 556  While this input method is active, the v
556        ;; Let's inactivate Quail input method.        ;; Let's inactivate Quail input method.
557        (unwind-protect        (unwind-protect
558            (progn            (progn
             (quail-hide-guidance-buf)  
559              (quail-delete-overlays)              (quail-delete-overlays)
560              (setq describe-current-input-method-function nil)              (setq describe-current-input-method-function nil)
561                (quail-hide-guidance)
562                (remove-hook 'post-command-hook 'quail-show-guidance t)
563              (run-hooks 'quail-inactivate-hook))              (run-hooks 'quail-inactivate-hook))
564          (kill-local-variable 'input-method-function))          (kill-local-variable 'input-method-function))
565      ;; Let's activate Quail input method.      ;; Let's activate Quail input method.
# Line 578  While this input method is active, the v Line 573  While this input method is active, the v
573      (setq inactivate-current-input-method-function 'quail-inactivate)      (setq inactivate-current-input-method-function 'quail-inactivate)
574      (setq describe-current-input-method-function 'quail-help)      (setq describe-current-input-method-function 'quail-help)
575      (quail-delete-overlays)      (quail-delete-overlays)
576      (quail-show-guidance-buf)      (setq quail-guidance-str "")
577        (quail-show-guidance)
578      ;; If we are in minibuffer, turn off the current input method      ;; If we are in minibuffer, turn off the current input method
579      ;; before exiting.      ;; before exiting.
580      (if (eq (selected-window) (minibuffer-window))      (when (eq (selected-window) (minibuffer-window))
581          (add-hook 'minibuffer-exit-hook 'quail-exit-from-minibuffer))        (add-hook 'minibuffer-exit-hook 'quail-exit-from-minibuffer)
582      (add-hook 'kill-buffer-hook 'quail-kill-guidance-buf nil t)        (add-hook 'post-command-hook 'quail-show-guidance nil t))
583      (run-hooks 'quail-activate-hook)      (run-hooks 'quail-activate-hook)
584      (make-local-variable 'input-method-function)      (make-local-variable 'input-method-function)
585      (setq input-method-function 'quail-input-method)))      (setq input-method-function 'quail-input-method)))
# Line 1313  Do so while interleaving with the follow Line 1309  Do so while interleaving with the follow
1309      (quail-setup-overlays (quail-conversion-keymap))      (quail-setup-overlays (quail-conversion-keymap))
1310      (let ((modified-p (buffer-modified-p))      (let ((modified-p (buffer-modified-p))
1311            (buffer-undo-list t))            (buffer-undo-list t))
       (or (and quail-guidance-win  
                (window-live-p quail-guidance-win)  
                (eq (window-buffer quail-guidance-win) quail-guidance-buf)  
                (not input-method-use-echo-area))  
           (quail-show-guidance-buf))  
1312        (unwind-protect        (unwind-protect
1313            (let ((input-string (if (quail-conversion-keymap)            (let ((input-string (if (quail-conversion-keymap)
1314                                    (quail-start-conversion key)                                    (quail-start-conversion key)
1315                                  (quail-start-translation key))))                                  (quail-start-translation key))))
1316                (setq quail-guidance-str "")
1317              (when (and (stringp input-string)              (when (and (stringp input-string)
1318                         (> (length input-string) 0))                         (> (length input-string) 0))
1319                (if input-method-exit-on-first-char                (if input-method-exit-on-first-char
1320                    (list (aref input-string 0))                    (list (aref input-string 0))
1321                  (quail-input-string-to-events input-string))))                  (quail-input-string-to-events input-string))))
1322          (quail-delete-overlays)          (quail-delete-overlays)
         (if (buffer-live-p quail-guidance-buf)  
             (with-current-buffer quail-guidance-buf  
               (erase-buffer)))  
         (quail-hide-guidance-buf)  
1323          (set-buffer-modified-p modified-p)          (set-buffer-modified-p modified-p)
1324          ;; Run this hook only when the current input method doesn't require          ;; Run this hook only when the current input method doesn't require
1325          ;; conversion.  When conversion is required, the conversion function          ;; conversion.  When conversion is required, the conversion function
# Line 1378  Return the input string." Line 1366  Return the input string."
1366              (setq unread-command-events (cons key unread-command-events)))              (setq unread-command-events (cons key unread-command-events)))
1367          (while quail-translating          (while quail-translating
1368            (set-buffer-modified-p modified-p)            (set-buffer-modified-p modified-p)
1369              (quail-show-guidance)
1370            (let* ((keyseq (read-key-sequence            (let* ((keyseq (read-key-sequence
1371                            (and input-method-use-echo-area                            (and input-method-use-echo-area
1372                                 (concat input-method-previous-message                                 (concat input-method-previous-message
# Line 1442  Return the input string." Line 1431  Return the input string."
1431                        quail-current-str ""                        quail-current-str ""
1432                        quail-translating t)                        quail-translating t)
1433                  (quail-setup-overlays nil)))                  (quail-setup-overlays nil)))
1434            ;; Hide '... loaded' message.            (quail-show-guidance)
           (message nil)  
1435            (let* ((keyseq (read-key-sequence            (let* ((keyseq (read-key-sequence
1436                            (and input-method-use-echo-area                            (and input-method-use-echo-area
1437                                 (concat input-method-previous-message                                 (concat input-method-previous-message
# Line 1492  Return the input string." Line 1480  Return the input string."
1480  (defun quail-terminate-translation ()  (defun quail-terminate-translation ()
1481    "Terminate the translation of the current key."    "Terminate the translation of the current key."
1482    (setq quail-translating nil)    (setq quail-translating nil)
1483    (if (buffer-live-p quail-guidance-buf)    (setq quail-guidance-str " "))
       (with-current-buffer quail-guidance-buf  
         (erase-buffer))))  
1484    
1485  (defun quail-select-current ()  (defun quail-select-current ()
1486    "Accept the currently selected translation."    "Accept the currently selected translation."
# Line 1535  with more keys." Line 1521  with more keys."
1521                          (quail-simple))                          (quail-simple))
1522                     (setq control-flag t)))))))                     (setq control-flag t)))))))
1523    (or input-method-use-echo-area    (or input-method-use-echo-area
1524        (progn        (let (pos)
1525          (quail-delete-region)          (quail-delete-region)
1526          (insert quail-current-str)))          (setq pos (point))
1527            (insert quail-current-str)
1528            (move-overlay quail-overlay pos (point))
1529            (if (overlayp quail-conv-overlay)
1530                (if (not (overlay-start quail-conv-overlay))
1531                    (move-overlay quail-conv-overlay pos (point))
1532                  (if (< (overlay-end quail-conv-overlay) (point))
1533                      (move-overlay quail-conv-overlay
1534                                    (overlay-start quail-conv-overlay)
1535                                    (point)))))))
1536    (let (quail-current-str)    (let (quail-current-str)
1537      (quail-update-guidance))      (quail-update-guidance))
1538    (or (stringp quail-current-str)    (or (stringp quail-current-str)
# Line 1601  Make RELATIVE-INDEX the current translat Line 1596  Make RELATIVE-INDEX the current translat
1596              (< cur start)               ; We moved to the previous block.              (< cur start)               ; We moved to the previous block.
1597              (>= cur end))               ; We moved to the next block.              (>= cur end))               ; We moved to the next block.
1598          (let ((len (length (cdr quail-current-translations)))          (let ((len (length (cdr quail-current-translations)))
1599                (maxcol (- (window-width quail-guidance-win)                (maxcol (- (window-width)
1600                           quail-guidance-translations-starting-column))                           quail-guidance-translations-starting-column))
1601                (block (nth 3 indices))                (block (nth 3 indices))
1602                col idx width trans num-items blocks)                col idx width trans num-items blocks)
# Line 1863  Remaining args are for FUNC." Line 1858  Remaining args are for FUNC."
1858    
1859  ;; Guidance, Completion, and Help buffer handlers.  ;; Guidance, Completion, and Help buffer handlers.
1860    
1861  (defun quail-make-guidance-frame (buf)  (defun quail-make-guidance-frame ()
1862    "Make a new one-line frame for Quail guidance buffer."    "Make a new one-line frame for Quail guidance."
1863    (let* ((fparam (frame-parameters))    (let* ((fparam (frame-parameters))
1864           (top (cdr (assq 'top fparam)))           (top (cdr (assq 'top fparam)))
1865           (border (cdr (assq 'border-width fparam)))           (border (cdr (assq 'border-width fparam)))
# Line 1872  Remaining args are for FUNC." Line 1867  Remaining args are for FUNC."
1867           (newtop (- top           (newtop (- top
1868                      (frame-char-height) (* internal-border 2) (* border 2))))                      (frame-char-height) (* internal-border 2) (* border 2))))
1869      (if (< newtop 0)      (if (< newtop 0)
1870          (setq newtop (+ top (frame-pixel-height))))          (setq newtop (+ top (frame-pixel-height) internal-border border)))
1871      (let* ((frame (make-frame (append '((user-position . t) (height . 1)      (make-frame (append '((user-position . t) (height . 1)
1872                                          (minibuffer) (menu-bar-lines . 0))                            (minibuffer)
1873                                        (cons (cons 'top newtop) fparam))))                            (menu-bar-lines . 0) (tool-bar-lines . 0))
1874             (win (frame-first-window frame)))                          (cons (cons 'top newtop) fparam)))))
       (set-window-buffer win buf)  
       ;;(set-window-dedicated-p win t)  
       )))  
1875    
1876  (defun quail-setup-completion-buf ()  (defun quail-setup-completion-buf ()
1877    "Setup Quail completion buffer."    "Setup Quail completion buffer."
# Line 1900  Remaining args are for FUNC." Line 1892  Remaining args are for FUNC."
1892               (not (quail-simple))               (not (quail-simple))
1893             t))))             t))))
1894    
 (defun quail-show-guidance-buf ()  
   "Display a guidance buffer for Quail input method in some window.  
 Create the buffer if it does not exist yet.  
 The buffer is normally displayed at the echo area,  
 but if the current buffer is a minibuffer, it is shown in  
 the bottom-most ordinary window of the same frame,  
 or in a newly created frame (if the selected frame has no other windows)."  
   (when (quail-require-guidance-buf)  
     ;; At first, setup a guidance buffer.  
     (let ((default-enable-multibyte-characters enable-multibyte-characters))  
       (or (buffer-live-p quail-guidance-buf)  
           (setq quail-guidance-buf (generate-new-buffer " *Quail-guidance*"))))  
     (let ((package quail-current-package))  
       (with-current-buffer quail-guidance-buf  
         ;; To show the title of Quail package.  
         (setq quail-current-package package  
               current-input-method (quail-name)  
               current-input-method-title (quail-title))  
         (erase-buffer)  
         (or (overlayp quail-overlay)  
             (progn  
               (setq quail-overlay (make-overlay 1 1))  
               (overlay-put quail-overlay 'face 'highlight)))  
         (delete-overlay quail-overlay)  
         (set-buffer-modified-p nil)))  
     (bury-buffer quail-guidance-buf)  
   
     ;; Assign the buffer " *Minibuf-N*" to all windows which are now  
     ;; displaying quail-guidance-buf.  
     (let ((win-list (get-buffer-window-list quail-guidance-buf t t)))  
       (while win-list  
         (set-window-buffer (car win-list)  
                            (format " *Minibuf-%d*" (minibuffer-depth)))  
         (setq win-list (cdr win-list))))  
   
     ;; Then, display it in an appropriate window.  
     (let ((win (minibuffer-window)))  
       (if (or (eq (selected-window) win)  
               input-method-use-echo-area)  
           ;; Since we are in minibuffer, we can't use it for guidance.  
           (if (eq win (frame-root-window))  
               ;; Create a frame.  It is sure that we are using some  
               ;; window system.  
               (quail-make-guidance-frame quail-guidance-buf)  
             ;; Find the bottom window and split it if necessary.  
             (setq win (window-at  
                        0 (1- (- (frame-height) (window-height win)))))  
             (let ((height (window-height win))  
                   (window-min-height 2))  
               ;; If WIN is tall enough, split it vertically and use  
               ;; the lower one.  
               (when (>= height 4)  
                 ;; Here, `split-window' returns a lower window  
                 ;; which is what we wanted.  
                 (setq win (split-window win (- height 2))))  
               (set-window-buffer win quail-guidance-buf)  
               (with-current-buffer quail-guidance-buf  
                 (fit-window-to-buffer win nil (window-height win)))))  
         (set-window-buffer win quail-guidance-buf)  
         (set-minibuffer-window win))  
       (setq quail-guidance-win win)))  
1895    
1896    ;; And, create a buffer for completion.  ;; Quail specific version of minibuffer-message.  It displays STRING
1897    ;; with timeout 1000000 seconds instead of two seconds.
1898    
1899    (defun quail-minibuffer-message (string)
1900      (message nil)
1901      (let ((point-max (point-max))
1902            (inhibit-quit t))
1903        (save-excursion
1904          (goto-char point-max)
1905          (insert string))
1906        (sit-for 1000000)
1907        (delete-region point-max (point-max))
1908        (when quit-flag
1909          (setq quit-flag nil
1910                unread-command-events '(7)))))
1911    
1912    (defun quail-show-guidance ()
1913      "Display a guidance for Quail input method in some window.
1914    The guidance is normally displayed at the echo area,
1915    or in a newly created frame (if the current buffer is a
1916    minibuffer and the selected frame has no other windows)."
1917      ;; At first, setup a buffer for completion.
1918    (quail-setup-completion-buf)    (quail-setup-completion-buf)
1919    (bury-buffer quail-completion-buf))    (bury-buffer quail-completion-buf)
1920    
1921  (defun quail-hide-guidance-buf ()    ;; Then, show the guidance.
1922    "Hide the Quail guidance buffer."    (when (and (quail-require-guidance-buf)
1923    (if (buffer-live-p quail-guidance-buf)               (null unread-command-events)
1924        (let ((win-list (get-buffer-window-list quail-guidance-buf t t))               (null unread-post-input-method-events))
1925              win)      (if (or (eq (selected-window) (minibuffer-window))
1926          (while win-list              input-method-use-echo-area)
1927            (setq win (car win-list) win-list (cdr win-list))          (if (eq (minibuffer-window) (frame-root-window))
1928            (if (window-minibuffer-p win)              ;; Use another frame.  It is sure that we are using some
1929                ;; We are using echo area for the guidance buffer.              ;; window system.
1930                ;; Vacate it to the deepest minibuffer.              (let ((guidance quail-guidance-str))
1931                (set-window-buffer win                (or (frame-live-p quail-guidance-frame)
1932                                   (format " *Minibuf-%d*" (minibuffer-depth)))                    (setq quail-guidance-frame
1933              (if (eq win (frame-root-window (window-frame win)))                          (quail-make-guidance-frame)))
1934                  (progn                (or (buffer-live-p quail-guidance-buf)
1935                    ;; We are using a separate frame for guidance buffer.                    (setq quail-guidance-buf
1936                    ;;(set-window-dedicated-p win nil)                          (get-buffer-create " *Quail-guidance*")))
1937                    (delete-frame (window-frame win)))                (save-excursion
1938                ;;(set-window-dedicated-p win nil)                  (set-buffer quail-guidance-buf)
1939                (delete-window win))))                  (erase-buffer)
1940          (setq quail-guidance-win nil))))                  (setq cursor-type nil)
1941                    (insert guidance))
1942                  (set-window-buffer (frame-root-window quail-guidance-frame)
1943                                     quail-guidance-buf)
1944                  (quail-minibuffer-message
1945                   (format " [%s]" current-input-method-title)))
1946              ;; Show the guidance in the next line of the currrent
1947              ;; minibuffer.
1948              (quail-minibuffer-message
1949               (format "  [%s]\n%s"
1950                       current-input-method-title quail-guidance-str)))
1951          ;; Show the guidance in echo area without logging.
1952          (let ((message-log-max nil))
1953            (message "%s" quail-guidance-str)))))
1954    
1955    (defun quail-hide-guidance ()
1956      "Hide the Quail guidance."
1957      (when (and (quail-require-guidance-buf)
1958                 (or (eq (selected-window) (minibuffer-window))
1959                     input-method-use-echo-area)
1960                 (eq (minibuffer-window) (frame-root-window)))
1961        ;; We are using another frame for the guidance.
1962        (if (frame-live-p quail-guidance-frame)
1963            (delete-frame quail-guidance-frame))
1964        (if (buffer-live-p quail-guidance-buf)
1965            (kill-buffer quail-guidance-buf))))
1966    
1967  (defun quail-update-guidance ()  (defun quail-update-guidance ()
1968    "Update the Quail guidance buffer and completion buffer (if displayed now)."    "Update the Quail guidance buffer and completion buffer (if displayed now)."
1969    ;; Update guidance buffer.    ;; Update the guidance string.
1970    (if (quail-require-guidance-buf)    (when (quail-require-guidance-buf)
1971        (let ((guidance (quail-guidance)))      (let ((guidance (quail-guidance)))
1972          (unless (and (eq (selected-frame) (window-frame (minibuffer-window)))        (cond ((or (eq guidance t)
1973                       (eq (selected-frame) (window-frame quail-guidance-win)))                   (consp guidance))
1974            ;; The guidance window is not shown in this frame, show it.               ;; Show the current possible translations.
1975            (quail-show-guidance-buf))               (setq quail-guidance-str
1976          (cond ((or (eq guidance t)                     (quail-get-translations)))
1977                     (consp guidance))              ((null guidance)
1978                 ;; Show the current possible translations.               ;; Show the current input keys.
1979                 (quail-show-translations))               (let ((key quail-current-key))
1980                ((null guidance)                 (if (quail-kbd-translate)
1981                 ;; Show the current input keys.                     (setq key (quail-keyseq-translate key)))
1982                 (let ((key quail-current-key))                 (setq quail-guidance-str (if (stringp key) key (string key)))))
1983                   (if (quail-kbd-translate)              (t
1984                       (setq key (quail-keyseq-translate key)))               (setq quail-guidance-str " ")))))
                  (with-current-buffer quail-guidance-buf  
                    (erase-buffer)  
                    (insert key)))))  
         ;; Make sure the height of the guidance window is OK --  
         ;; sometimes, if the minibuffer window expands due to user  
         ;; input (for instance if the newly inserted character is in a  
         ;; different font), it will cause the guidance window to be  
         ;; only partially visible.  We force a redisplay first because  
         ;; this automatic expansion doesn't happen until then, and we  
         ;; want to see the window sizes after the expansion.  
         (sit-for 0)  
         (fit-window-to-buffer quail-guidance-win nil  
                               (window-height quail-guidance-win))))  
1985    
1986    ;; Update completion buffer if displayed now.  We highlight the    ;; Update completion buffer if displayed now.  We highlight the
1987    ;; selected candidate string in *Completion* buffer if any.    ;; selected candidate string in *Completion* buffer if any.
# Line 2036  or in a newly created frame (if the sele Line 2000  or in a newly created frame (if the sele
2000                (delete-overlay quail-overlay)                (delete-overlay quail-overlay)
2001              (setq pos (point))              (setq pos (point))
2002              (if (and str (search-forward (concat "." str) nil t))              (if (and str (search-forward (concat "." str) nil t))
2003                    (move-overlay quail-overlay (1+ (match-beginning 0)) (point))                  (move-overlay quail-overlay (1+ (match-beginning 0)) (point))
2004                  (move-overlay quail-overlay (match-beginning 0) (point)))                (move-overlay quail-overlay (match-beginning 0) (point)))
2005              ;; Now POS points end of KEY and (point) points end of STR.              ;; Now POS points end of KEY and (point) points end of STR.
2006              (if (pos-visible-in-window-p (point) win)              (if (pos-visible-in-window-p (point) win)
2007                  ;; STR is already visible.                  ;; STR is already visible.
# Line 2051  or in a newly created frame (if the sele Line 2015  or in a newly created frame (if the sele
2015                    (set-window-start win pos))                    (set-window-start win pos))
2016                ))))))                ))))))
2017    
2018  (defun quail-show-translations ()  (defun quail-get-translations ()
2019    "Show the current possible translations."    "Return a string containing the current possible translations."
2020    (let* ((key quail-current-key)    (let ((map (quail-lookup-key quail-current-key))
2021           (map (quail-lookup-key quail-current-key))          (str (copy-sequence quail-current-key)))
          (current-translations quail-current-translations))  
2022      (if quail-current-translations      (if quail-current-translations
2023          (quail-update-current-translations))          (quail-update-current-translations))
     (with-current-buffer quail-guidance-buf  
       (erase-buffer)  
2024    
2025        ;; Show the current key.      ;; Show the current key.
2026        (let ((guidance (quail-guidance)))      (let ((guidance (quail-guidance)))
2027          (if (listp guidance)        (if (listp guidance)
2028              ;; We must show the specified PROMPTKEY instead of the            ;; We must replace thetyped key with the specified PROMPTKEY.
2029              ;; actual typed keys.            (dotimes (i (length str))
2030              (let ((i 0)              (let ((prompt-key (cdr (assoc (aref str i) guidance))))
2031                    (len (length key))                (if prompt-key
2032                    prompt-key)                    (aset str i (aref prompt-key 0)))))))
               (while (< i len)  
                 (setq prompt-key (cdr (assoc (aref key i) guidance)))  
                 (insert (or prompt-key (aref key i)))  
                 (setq i (1+ i))))  
           (insert key)))  
2033    
2034        ;; Show followable keys.        ;; Show followable keys.
2035        (if (and (> (length key) 0) (cdr map))        (if (and (> (length quail-current-key) 0) (cdr map))
2036            (let ((keys (mapcar (function (lambda (x) (car x)))            (setq str
2037                                (cdr map))))                  (format "%s[%s]"
2038              (setq keys (sort keys '<))                          str
2039              (insert "[")                          (concat (sort (mapcar (function (lambda (x) (car x)))
2040              (while keys                                                (cdr map))
2041                (insert (car keys))                                        '<)))))
               (setq keys (cdr keys)))  
             (insert "]")))  
   
2042        ;; Show list of translations.        ;; Show list of translations.
2043        (if (and current-translations        (if (and quail-current-translations
2044                 (not (quail-deterministic)))                 (not (quail-deterministic)))
2045            (let* ((indices (car current-translations))            (let* ((indices (car quail-current-translations))
2046                   (cur (car indices))                   (cur (car indices))
2047                   (start (nth 1 indices))                   (start (nth 1 indices))
2048                   (end (nth 2 indices))                   (end (nth 2 indices))
2049                   (idx start))                   (idx start))
2050              (indent-to (- quail-guidance-translations-starting-column 7))              (if (< (string-width str)
2051              (insert (format "(%02d/"(nth 3 indices))                     (- quail-guidance-translations-starting-column 7))
2052                      (if (nth 4 indices)                  (setq str
2053                          (format "%02d)" (nth 4 indices))                        (concat str
2054                        "??)"))                                (make-string
2055                                   (- quail-guidance-translations-starting-column
2056                                      7 (string-width str))
2057                                   32))))
2058                (setq str (format "%s(%02d/%s)"
2059                                  str (nth 3 indices)
2060                                  (if (nth 4 indices)
2061                                      (format "%02d" (nth 4 indices))
2062                                    "??")))
2063              (while (< idx end)              (while (< idx end)
2064                (insert (format " %d." (if (= (- idx start) 9) 0                (let ((len (length str))
2065                                         (1+ (- idx start)))))                      (trans (aref (cdr quail-current-translations) idx)))
2066                (let ((pos (point)))                  (or (stringp trans)
2067                  (insert (aref (cdr current-translations) idx))                      (setq trans (string trans)))
2068                    (setq str (format "%s %d.%s"
2069                                      str
2070                                      (if (= (- idx start) 9) 0
2071                                        (1+ (- idx start)))
2072                                      trans))
2073                  (if (= idx cur)                  (if (= idx cur)
2074                      (move-overlay quail-overlay pos (point))))                      (put-text-property (+ len 3) (length str)
2075                (setq idx (1+ idx)))))                                        'face 'highlight str))
2076        )))                  (setq idx (1+ idx))))))
2077    
2078          str))
2079    
2080  (defvar quail-completion-max-depth 5  (defvar quail-completion-max-depth 5
2081    "The maximum depth of Quail completion list.")    "The maximum depth of Quail completion list.")

Legend:
Removed from v.1.127  
changed lines
  Added in v.1.128

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26