Function: quail-start-translation
quail-start-translation is a byte-compiled function defined in
quail.el.gz.
Signature
(quail-start-translation KEY)
Documentation
Start translation of the typed character KEY by the current Quail package.
Return the input string.
Source Code
;; Defined in /usr/src/emacs/lisp/international/quail.el.gz
(defun quail-start-translation (key)
"Start translation of the typed character KEY by the current Quail package.
Return the input string."
;; Check the possibility of translating KEY.
;; If KEY is nil, we can anyway start translation.
(if (or (and (integerp key)
(assq (if (quail-kbd-translate)
(quail-keyboard-translate key) key)
(cdr (quail-map))))
(null key))
;; OK, we can start translation.
(let* ((echo-keystrokes 0)
(help-char nil)
(overriding-terminal-local-map (quail-translation-keymap))
;; (generated-events nil) ;FIXME: What is this?
(input-method-function nil)
(modified-p (buffer-modified-p))
last-command-event last-command this-command)
(setq quail-current-key ""
quail-current-str ""
quail-translating t)
(if key (quail-add-unread-command-events key))
(while quail-translating
(set-buffer-modified-p modified-p)
(quail-show-guidance)
(let* ((prompt (if input-method-use-echo-area
(format "%s%s %s"
(or input-method-previous-message "")
quail-current-str
quail-guidance-str)))
(keyseq (read-key-sequence prompt nil nil t))
(cmd (lookup-key (quail-translation-keymap) keyseq)))
(if (if key
(and (commandp cmd) (not (eq cmd 'quail-other-command)))
(eq cmd 'quail-self-insert-command))
(progn
(setq last-command-event (aref keyseq (1- (length keyseq)))
last-command this-command
this-command cmd)
(setq key t)
(condition-case err
(call-interactively cmd)
(quail-error (message "%s" (cdr err)) (beep))))
;; KEYSEQ is not defined in the translation keymap.
;; Let's return the event(s) to the caller.
(quail-add-unread-command-events (this-single-command-raw-keys))
(setq quail-translating nil))))
(quail-delete-region)
quail-current-str)
;; Since KEY doesn't start any translation, just return it.
;; But translate KEY if necessary.
(if (quail-kbd-translate)
(setq key (quail-keyboard-translate key)))
(char-to-string key)))