Function: quail-map-from-table
quail-map-from-table is a byte-compiled function defined in
quail.el.gz.
Signature
(quail-map-from-table TABLE)
Documentation
Make quail map from state transition table TABLE.
TABLE is an alist, the form is:
((STATE-0 TRANSITION-0-1 TRANSITION-0-2 ...) (STATE-1 ...) ...)
STATE-n are symbols to denote state. STATE-0 is the initial state.
TRANSITION-n-m are transition rules from STATE-n, and have the form
(RULES . STATE-x) or RULES, where STATE-x is one of STATE-n above,
RULES is a symbol whose value is an alist of keys (string) vs the
corresponding characters or strings. The format of the symbol value of
RULES is the same as arguments to quail-define-rules.
If TRANSITION-n-m has the form (RULES . STATE-x), it means that STATE-n transits to STATE-x when keys in RULES are input. Recursive transition is allowed, i.e. STATE-x may be STATE-n.
If TRANSITION-n-m has the form RULES, the transition terminates when keys in RULES are input.
The generated map can be set for the current Quail package by the
function quail-install-map (which see).
Source Code
;; Defined in /usr/src/emacs/lisp/international/quail.el.gz
;; Quail map generator from state transition table.
(defun quail-map-from-table (table)
"Make quail map from state transition table TABLE.
TABLE is an alist, the form is:
((STATE-0 TRANSITION-0-1 TRANSITION-0-2 ...) (STATE-1 ...) ...)
STATE-n are symbols to denote state. STATE-0 is the initial state.
TRANSITION-n-m are transition rules from STATE-n, and have the form
\(RULES . STATE-x) or RULES, where STATE-x is one of STATE-n above,
RULES is a symbol whose value is an alist of keys \(string) vs the
corresponding characters or strings. The format of the symbol value of
RULES is the same as arguments to `quail-define-rules'.
If TRANSITION-n-m has the form (RULES . STATE-x), it means that
STATE-n transits to STATE-x when keys in RULES are input. Recursive
transition is allowed, i.e. STATE-x may be STATE-n.
If TRANSITION-n-m has the form RULES, the transition terminates
when keys in RULES are input.
The generated map can be set for the current Quail package by the
function `quail-install-map' (which see)."
(let ((state-alist (mapcar (lambda (x) (list (car x))) table))
tail elt)
;; STATE-ALIST is an alist of states vs the corresponding sub Quail
;; map. It is now initialized to ((STATE-0) (STATE-1) ...).
;; Set key sequence mapping rules in cdr part of each element.
(while table
(quail-map-from-table-1 state-alist (car table))
(setq table (cdr table)))
;; Now STATE-ALIST has the form ((STATE-0 MAPPING-RULES) ...).
;; Elements of MAPPING-RULES may have the form (STATE-x). Replace
;; them with MAPPING-RULES of STATE-x to make elements of
;; STATE-ALIST valid Quail maps.
(setq tail state-alist)
(while tail
(setq elt (car tail) tail (cdr tail))
(quail-map-from-table-2 state-alist elt))
;; Return the Quail map for the initial state.
(car state-alist)))