1 |
;;; quail.el --- Provides simple input method for multilingual text |
;;; quail.el --- provides simple input method for multilingual text |
2 |
|
|
3 |
;; Copyright (C) 1995, 2000 Electrotechnical Laboratory, JAPAN. |
;; Copyright (C) 1995, 2000 Electrotechnical Laboratory, JAPAN. |
4 |
;; Licensed to the Free Software Foundation. |
;; Licensed to the Free Software Foundation. |
5 |
|
;; Copyright (C) 2001 Free Software Foundation, Inc. |
6 |
|
|
7 |
;; Author: Kenichi HANDA <handa@etl.go.jp> |
;; Author: Kenichi HANDA <handa@etl.go.jp> |
8 |
;; Naoto TAKAHASHI <ntakahas@etl.go.jp> |
;; Naoto TAKAHASHI <ntakahas@etl.go.jp> |
9 |
;; Maintainer: Kenichi HANDA <handa@etl.go.jp> |
;; Maintainer: Kenichi HANDA <handa@etl.go.jp> |
10 |
;; Keywords: mule, multilingual, input method |
;; Keywords: mule, multilingual, input method, i18n |
11 |
|
|
12 |
;; This file is part of GNU Emacs. |
;; This file is part of GNU Emacs. |
13 |
|
|
42 |
;; Kanji-and-Kana mixed text or Katakana text by commands specified in |
;; Kanji-and-Kana mixed text or Katakana text by commands specified in |
43 |
;; CONVERSION-KEYS argument of the Quail package. |
;; CONVERSION-KEYS argument of the Quail package. |
44 |
|
|
45 |
|
;; [There was an input method for Mule 2.3 called `Tamago' from the |
46 |
|
;; Japanese `TAkusan MAtasete GOmenasai', or `Sorry for having you |
47 |
|
;; wait so long'; this couldn't be included in Emacs 20. `Tamago' is |
48 |
|
;; Japanese for `egg' (implicitly a hen's egg). Handa-san made a |
49 |
|
;; smaller and simpler system; the smaller quail egg is also eaten in |
50 |
|
;; Japan. Maybe others will be egged on to write more sorts of input |
51 |
|
;; methods.] |
52 |
|
|
53 |
;;; Code: |
;;; Code: |
54 |
|
|
55 |
(defgroup quail nil |
(defgroup quail nil |
134 |
(defsubst quail-name () |
(defsubst quail-name () |
135 |
"Return the name of the current Quail package." |
"Return the name of the current Quail package." |
136 |
(nth 0 quail-current-package)) |
(nth 0 quail-current-package)) |
137 |
(defsubst quail-title () |
;;;###autoload |
138 |
|
(defun quail-title () |
139 |
"Return the title of the current Quail package." |
"Return the title of the current Quail package." |
140 |
(nth 1 quail-current-package)) |
(let ((title (nth 1 quail-current-package))) |
141 |
|
;; TITLE may be a string or a list. If it is a list, each element |
142 |
|
;; is a string or the form (VAR STR1 STR2), and the interpretation |
143 |
|
;; of the list is the same as that of mode-line-format. |
144 |
|
(if (stringp title) |
145 |
|
title |
146 |
|
(condition-case nil |
147 |
|
(mapconcat |
148 |
|
(lambda (x) |
149 |
|
(cond ((stringp x) x) |
150 |
|
((and (listp x) (symbolp (car x)) (= (length x) 3)) |
151 |
|
(if (symbol-value (car x)) |
152 |
|
(nth 1 x) (nth 2 x))) |
153 |
|
(t ""))) |
154 |
|
title "") |
155 |
|
(error ""))))) |
156 |
(defsubst quail-map () |
(defsubst quail-map () |
157 |
"Return the translation map of the current Quail package." |
"Return the translation map of the current Quail package." |
158 |
(nth 2 quail-current-package)) |
(nth 2 quail-current-package)) |
229 |
;;;###autoload |
;;;###autoload |
230 |
(defun quail-use-package (package-name &rest libraries) |
(defun quail-use-package (package-name &rest libraries) |
231 |
"Start using Quail package PACKAGE-NAME. |
"Start using Quail package PACKAGE-NAME. |
232 |
The remaining arguments are libraries to be loaded before using the package." |
The remaining arguments are libraries to be loaded before using the package. |
233 |
|
|
234 |
|
This activates input method defined by PACKAGE-NAME by running |
235 |
|
`quail-activate', which see." |
236 |
(let ((package (quail-package package-name))) |
(let ((package (quail-package package-name))) |
237 |
(if (null package) |
(if (null package) |
238 |
;; Perhaps we have not yet loaded necessary libraries. |
;; Perhaps we have not yet loaded necessary libraries. |
540 |
(kill-buffer quail-guidance-buf))) |
(kill-buffer quail-guidance-buf))) |
541 |
|
|
542 |
(defun quail-inactivate () |
(defun quail-inactivate () |
543 |
"Inactivate Quail input method." |
"Inactivate Quail input method. |
544 |
|
|
545 |
|
This function runs the normal hook `quail-inactivate-hook'." |
546 |
(interactive) |
(interactive) |
547 |
(quail-activate -1)) |
(quail-activate -1)) |
548 |
|
|
550 |
"Activate Quail input method. |
"Activate Quail input method. |
551 |
With arg, activate Quail input method if and only if arg is positive. |
With arg, activate Quail input method if and only if arg is positive. |
552 |
|
|
553 |
|
This function runs `quail-activate-hook' if it activates the input |
554 |
|
method, `quail-inactivate-hook' if it deactivates it. |
555 |
|
|
556 |
While this input method is active, the variable |
While this input method is active, the variable |
557 |
`input-method-function' is bound to the function `quail-input-method'." |
`input-method-function' is bound to the function `quail-input-method'." |
558 |
(if (and arg |
(if (and arg |
626 |
the first column of the fifth row is left of key `z', |
the first column of the fifth row is left of key `z', |
627 |
the sixth row is below the `z' - `/' row. |
the sixth row is below the `z' - `/' row. |
628 |
Nth (N is even) and (N+1)th characters in the string are non-shifted |
Nth (N is even) and (N+1)th characters in the string are non-shifted |
629 |
and shifted characters respectively at the same location. |
and shifted characters respectively at the same location. |
630 |
The location of Nth character is row (N / 30) and column ((N mod 30) / 2). |
The location of Nth character is row (N / 30) and column ((N mod 30) / 2). |
631 |
The command `quail-set-keyboard-layout' usually sets this variable.") |
The command `quail-set-keyboard-layout' usually sets this variable.") |
632 |
|
|
667 |
aAsSdDfFgGhHjJkKlL;+:*]} \ |
aAsSdDfFgGhHjJkKlL;+:*]} \ |
668 |
zZxXcCvVbBnNmM,<.>/?\\_ \ |
zZxXcCvVbBnNmM,<.>/?\\_ \ |
669 |
") |
") |
670 |
|
'("pc105-uk" . "\ |
671 |
|
\ |
672 |
|
`\2541!2\3\243$5%6^7&8*9(0)-_=+ \ |
673 |
|
qQwWeErRtTyYuUiIoOpP[{]} \ |
674 |
|
aAsSdDfFgGhHjJkKlL;:'@#~ \ |
675 |
|
\\|zZxXcCvVbBnNmM,<.>/? \ |
676 |
|
") |
677 |
) |
) |
678 |
"Alist of keyboard names and corresponding layout strings. |
"Alist of keyboard names and corresponding layout strings. |
679 |
See the documentation of `quail-keyboard-layout' for the format of |
See the documentation of `quail-keyboard-layout' for the format of |
718 |
"Type of keyboard layout used in Quail base input method. |
"Type of keyboard layout used in Quail base input method. |
719 |
Available types are listed in the variable `quail-keyboard-layout-alist'." |
Available types are listed in the variable `quail-keyboard-layout-alist'." |
720 |
:group 'quail |
:group 'quail |
721 |
:type 'string |
:type (cons 'choice (mapcar (lambda (elt) |
722 |
|
(list 'const (car elt))) |
723 |
|
quail-keyboard-layout-alist)) |
724 |
:set #'(lambda (symbol value) |
:set #'(lambda (symbol value) |
725 |
(quail-update-keyboard-layout value) |
(quail-update-keyboard-layout value) |
726 |
(set symbol value))) |
(set symbol value))) |
775 |
(mapcar (function (lambda (x) (quail-keyboard-translate x))) |
(mapcar (function (lambda (x) (quail-keyboard-translate x))) |
776 |
keyseq))) |
keyseq))) |
777 |
|
|
|
;; Insert the visual keyboard layout table according to KBD-LAYOUT. |
|
|
;; The format of KBD-LAYOUT is the same as `quail-keyboard-layout'. |
|
778 |
(defun quail-insert-kbd-layout (kbd-layout) |
(defun quail-insert-kbd-layout (kbd-layout) |
779 |
|
"Insert the visual keyboard layout table according to KBD-LAYOUT. |
780 |
|
The format of KBD-LAYOUT is the same as `quail-keyboard-layout'." |
781 |
(let (done-list layout i ch) |
(let (done-list layout i ch) |
782 |
;; At first, convert KBD-LAYOUT to the same size vector that |
;; At first, convert KBD-LAYOUT to the same size vector that |
783 |
;; contains translated character or string. |
;; contains translated character or string. |
1250 |
(if (not (equal def translation)) |
(if (not (equal def translation)) |
1251 |
;; We must reflect TRANSLATION to car part of MAP. |
;; We must reflect TRANSLATION to car part of MAP. |
1252 |
(setcar map translation))) |
(setcar map translation))) |
1253 |
(if (and (consp translation) (vectorp (cdr translation))) |
(if (and (consp translation) (vectorp (cdr translation))) |
1254 |
(progn |
(progn |
1255 |
(setq quail-current-translations translation) |
(setq quail-current-translations translation) |
1256 |
(if (quail-forget-last-selection) |
(if (quail-forget-last-selection) |
1265 |
(signal 'quail-error (apply 'format args))) |
(signal 'quail-error (apply 'format args))) |
1266 |
|
|
1267 |
|
|
|
;; Convert input string STR to a list of events while interleaving |
|
|
;; with the following special events: |
|
|
;; (compose-last-chars LEN COMPONENTS) |
|
|
;; (quail-advice INPUT-STRING) |
|
|
|
|
1268 |
(defun quail-input-string-to-events (str) |
(defun quail-input-string-to-events (str) |
1269 |
(let* ((events (string-to-list str)) |
"Convert input string STR to a list of events. |
1270 |
|
Do so while interleaving with the following special events: |
1271 |
|
\(compose-last-chars LEN COMPONENTS) |
1272 |
|
\(quail-advice INPUT-STRING)" |
1273 |
|
(let* ((events (mapcar |
1274 |
|
(lambda (c) |
1275 |
|
;; This gives us the chance to unify on input |
1276 |
|
;; (e.g. ucs-tables.el). |
1277 |
|
(or (aref standard-translation-table-for-decode c) |
1278 |
|
c)) |
1279 |
|
str)) |
1280 |
(len (length str)) |
(len (length str)) |
1281 |
(idx len) |
(idx len) |
1282 |
composition from to) |
composition from to) |
1466 |
(setq unread-command-events |
(setq unread-command-events |
1467 |
(string-to-list (this-single-command-raw-keys))) |
(string-to-list (this-single-command-raw-keys))) |
1468 |
(setq quail-converting nil)))) |
(setq quail-converting nil)))) |
1469 |
|
(setq quail-translating nil) |
1470 |
(if (overlay-start quail-conv-overlay) |
(if (overlay-start quail-conv-overlay) |
1471 |
(delete-region (overlay-start quail-conv-overlay) |
(delete-region (overlay-start quail-conv-overlay) |
1472 |
(overlay-end quail-conv-overlay))) |
(overlay-end quail-conv-overlay))) |
1492 |
(interactive) |
(interactive) |
1493 |
(quail-terminate-translation)) |
(quail-terminate-translation)) |
1494 |
|
|
|
;; Update the current translation status according to CONTROL-FLAG. |
|
|
;; If CONTROL-FLAG is integer value, it is the number of keys in the |
|
|
;; head quail-current-key which can be translated. The remaining keys |
|
|
;; are put back to unread-command-events to be handled again. If |
|
|
;; CONTROL-FLAG is t, terminate the translation for the whole keys in |
|
|
;; quail-current-key. If CONTROL-FLAG is nil, proceed the translation |
|
|
;; with more keys. |
|
|
|
|
1495 |
(defun quail-update-translation (control-flag) |
(defun quail-update-translation (control-flag) |
1496 |
|
"Update the current translation status according to CONTROL-FLAG. |
1497 |
|
If CONTROL-FLAG is integer value, it is the number of keys in the |
1498 |
|
head `quail-current-key' which can be translated. The remaining keys |
1499 |
|
are put back to `unread-command-events' to be handled again. If |
1500 |
|
CONTROL-FLAG is t, terminate the translation for the whole keys in |
1501 |
|
`quail-current-key'. If CONTROL-FLAG is nil, proceed the translation |
1502 |
|
with more keys." |
1503 |
(let ((func (quail-update-translation-function))) |
(let ((func (quail-update-translation-function))) |
1504 |
(if func |
(if func |
1505 |
(setq control-flag (funcall func control-flag)) |
(setq control-flag (funcall func control-flag)) |
1548 |
;; translation mode. |
;; translation mode. |
1549 |
(setq quail-translating nil))) |
(setq quail-translating nil))) |
1550 |
|
|
|
;; Return the actual definition part of Quail map MAP. |
|
1551 |
(defun quail-map-definition (map) |
(defun quail-map-definition (map) |
1552 |
|
"Return the actual definition part of Quail map MAP." |
1553 |
(let ((def (car map))) |
(let ((def (car map))) |
1554 |
(if (and (consp def) (not (vectorp (cdr def)))) |
(if (and (consp def) (not (vectorp (cdr def)))) |
1555 |
(setq def (car def))) |
(setq def (car def))) |
1557 |
(setq def nil)) |
(setq def nil)) |
1558 |
def)) |
def)) |
1559 |
|
|
|
;; Return a string to be shown as the current translation of key |
|
|
;; sequence of length LEN. DEF is a definition part of Quail map for |
|
|
;; the sequence. |
|
1560 |
(defun quail-get-current-str (len def) |
(defun quail-get-current-str (len def) |
1561 |
|
"Return string to be shown as current translation of key sequence. |
1562 |
|
LEN is the length of the sequence. DEF is a definition part of the |
1563 |
|
Quail map for the sequence." |
1564 |
(or (and (consp def) (aref (cdr def) (car (car def)))) |
(or (and (consp def) (aref (cdr def) (car (car def)))) |
1565 |
def |
def |
1566 |
(and (> len 1) |
(and (> len 1) |
1574 |
|
|
1575 |
(defvar quail-guidance-translations-starting-column 20) |
(defvar quail-guidance-translations-starting-column 20) |
1576 |
|
|
|
;; Update `quail-current-translations' to make RELATIVE-INDEX the |
|
|
;; current translation. |
|
1577 |
(defun quail-update-current-translations (&optional relative-index) |
(defun quail-update-current-translations (&optional relative-index) |
1578 |
|
"Update `quail-current-translations'. |
1579 |
|
Make RELATIVE-INDEX the current translation." |
1580 |
(let* ((indices (car quail-current-translations)) |
(let* ((indices (car quail-current-translations)) |
1581 |
(cur (car indices)) |
(cur (car indices)) |
1582 |
(start (nth 1 indices)) |
(start (nth 1 indices)) |
1661 |
;; giving up, we must check two possibilities. |
;; giving up, we must check two possibilities. |
1662 |
(cond ((and |
(cond ((and |
1663 |
(quail-maximum-shortest) |
(quail-maximum-shortest) |
1664 |
(>= len 4) |
(>= len 3) |
1665 |
(setq def (quail-map-definition |
(setq def (quail-map-definition |
1666 |
(quail-lookup-key quail-current-key (- len 2)))) |
(quail-lookup-key quail-current-key (- len 2)))) |
1667 |
(quail-lookup-key (substring quail-current-key -2) 2)) |
(quail-lookup-key (substring quail-current-key -2) 2)) |
1854 |
|
|
1855 |
;; Guidance, Completion, and Help buffer handlers. |
;; Guidance, Completion, and Help buffer handlers. |
1856 |
|
|
|
;; Make a new one-line frame for Quail guidance buffer. |
|
1857 |
(defun quail-make-guidance-frame (buf) |
(defun quail-make-guidance-frame (buf) |
1858 |
|
"Make a new one-line frame for Quail guidance buffer." |
1859 |
(let* ((fparam (frame-parameters)) |
(let* ((fparam (frame-parameters)) |
1860 |
(top (cdr (assq 'top fparam))) |
(top (cdr (assq 'top fparam))) |
1861 |
(border (cdr (assq 'border-width fparam))) |
(border (cdr (assq 'border-width fparam))) |
1872 |
;;(set-window-dedicated-p win t) |
;;(set-window-dedicated-p win t) |
1873 |
))) |
))) |
1874 |
|
|
|
;; Setup Quail completion buffer. |
|
1875 |
(defun quail-setup-completion-buf () |
(defun quail-setup-completion-buf () |
1876 |
|
"Setup Quail completion buffer." |
1877 |
(unless (buffer-live-p quail-completion-buf) |
(unless (buffer-live-p quail-completion-buf) |
1878 |
(let ((default-enable-multibyte-characters enable-multibyte-characters)) |
(let ((default-enable-multibyte-characters enable-multibyte-characters)) |
1879 |
(setq quail-completion-buf (get-buffer-create "*Quail Completions*"))) |
(setq quail-completion-buf (get-buffer-create "*Quail Completions*"))) |
1882 |
(setq quail-overlay (make-overlay 1 1)) |
(setq quail-overlay (make-overlay 1 1)) |
1883 |
(overlay-put quail-overlay 'face 'highlight)))) |
(overlay-put quail-overlay 'face 'highlight)))) |
1884 |
|
|
|
;; Return t iff the current Quail package requires showing guidance |
|
|
;; buffer. |
|
1885 |
(defun quail-require-guidance-buf () |
(defun quail-require-guidance-buf () |
1886 |
|
"Return t iff the current Quail package requires showing guidance buffer." |
1887 |
(and input-method-verbose-flag |
(and input-method-verbose-flag |
1888 |
(if (eq input-method-verbose-flag 'default) |
(if (eq input-method-verbose-flag 'default) |
1889 |
(not (and (eq (selected-window) (minibuffer-window)) |
(not (and (eq (selected-window) (minibuffer-window)) |
2140 |
(quail-update-guidance))) |
(quail-update-guidance))) |
2141 |
(setq this-command 'quail-completion)) |
(setq this-command 'quail-completion)) |
2142 |
|
|
|
;; List all completions of KEY in MAP with indentation INDENT. |
|
2143 |
(defun quail-completion-1 (key map indent) |
(defun quail-completion-1 (key map indent) |
2144 |
|
"List all completions of KEY in MAP with indentation INDENT." |
2145 |
(let ((len (length key))) |
(let ((len (length key))) |
2146 |
(indent-to indent) |
(indent-to indent) |
2147 |
(insert key ":") |
(insert key ":") |
2161 |
(while (< i len) |
(while (< i len) |
2162 |
(aset newkey i (aref key i)) |
(aset newkey i (aref key i)) |
2163 |
(setq i (1+ i))) |
(setq i (1+ i))) |
2164 |
|
(setq l (reverse l)) |
2165 |
(while l ; L = ((CHAR . DEFN) ....) ; |
(while l ; L = ((CHAR . DEFN) ....) ; |
2166 |
(aset newkey len (car (car l))) |
(aset newkey len (car (car l))) |
2167 |
(quail-completion-1 newkey (cdr (car l)) indent) |
(quail-completion-1 newkey (cdr (car l)) indent) |
2168 |
(setq l (cdr l))))))) |
(setq l (cdr l))))))) |
2169 |
|
|
|
;; List all possible translations of KEY in Quail map MAP with |
|
|
;; indentation INDENT. |
|
2170 |
(defun quail-completion-list-translations (map key indent) |
(defun quail-completion-list-translations (map key indent) |
2171 |
|
"List all possible translations of KEY in Quail MAP with indentation INDENT." |
2172 |
(let (beg (translations |
(let (beg (translations |
2173 |
(quail-get-translation (car map) key (length key)))) |
(quail-get-translation (car map) key (length key)))) |
2174 |
(if (integerp translations) |
(if (integerp translations) |
2202 |
(setq i (1+ i))) |
(setq i (1+ i))) |
2203 |
(insert "\n"))))) |
(insert "\n"))))) |
2204 |
|
|
|
;; Choose a completion in *Quail Completions* buffer with mouse-2. |
|
|
|
|
2205 |
(defun quail-mouse-choose-completion (event) |
(defun quail-mouse-choose-completion (event) |
2206 |
"Click on an alternative in the `*Quail Completions*' buffer to choose it." |
"Click on an alternative in the `*Quail Completions*' buffer to choose it." |
2207 |
(interactive "e") |
(interactive "e") |
2208 |
;; This function is an exact copy of the mouse.el function |
;; This function is an exact copy of the mouse.el function |
2209 |
;; `mouse-choose-completion' except that we: |
;; `mouse-choose-completion' except that we: |
2210 |
;; 1) add two lines from `choose-completion' in simple.el to give |
;; 1) add two lines from `choose-completion' in simple.el to give |
2211 |
;; the `mouse-2' click a little more leeway. |
;; the `mouse-2' click a little more leeway. |
2212 |
;; 2) don't bury *Quail Completions* buffer so comment a section, and |
;; 2) don't bury *Quail Completions* buffer, so comment a section, and |
2213 |
;; 3) delete/terminate the current quail selection here. |
;; 3) delete/terminate the current quail selection here. |
2214 |
;; Give temporary modes such as isearch a chance to turn off. |
;; Give temporary modes such as isearch a chance to turn off. |
2215 |
(run-hooks 'mouse-leave-buffer-hook) |
(run-hooks 'mouse-leave-buffer-hook) |
2247 |
(quail-choose-completion-string choice buffer base-size) |
(quail-choose-completion-string choice buffer base-size) |
2248 |
(quail-terminate-translation))) |
(quail-terminate-translation))) |
2249 |
|
|
2250 |
;; Modify the simple.el function `choose-completion-string', because |
(defun quail-choose-completion-string (choice &optional buffer) |
2251 |
;; the simple.el function `choose-completion-delete-max-match' breaks |
(setq quail-current-str choice) |
2252 |
;; on Mule data, since the semantics of `forward-char' have changed. |
(choose-completion-string choice buffer)) |
|
|
|
|
(defun quail-choose-completion-string (choice &optional buffer base-size) |
|
|
(let ((buffer (or buffer completion-reference-buffer))) |
|
|
;; If BUFFER is a minibuffer, barf unless it's the currently |
|
|
;; active minibuffer. |
|
|
(if (and (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" (buffer-name buffer)) |
|
|
(or (not (active-minibuffer-window)) |
|
|
(not (equal buffer |
|
|
(window-buffer (active-minibuffer-window)))))) |
|
|
(quail-error "Minibuffer is not active for completion") |
|
|
;; Store the completion in `quail-current-str', which will later |
|
|
;; be converted to a character event list, then inserted into |
|
|
;; the buffer where completion was requested. |
|
|
(set-buffer buffer) |
|
|
; (if base-size |
|
|
; (delete-region (+ base-size (point-min)) (point)) |
|
|
; (choose-completion-delete-max-match choice)) |
|
|
(setq quail-current-str choice) |
|
|
;; Update point in the window that BUFFER is showing in. |
|
|
(let ((window (get-buffer-window buffer t))) |
|
|
(set-window-point window (point))) |
|
|
;; If completing for the minibuffer, exit it with this choice. |
|
|
(and (not completion-no-auto-exit) |
|
|
(equal buffer (window-buffer (minibuffer-window))) |
|
|
minibuffer-completion-table |
|
|
;; If this is reading a file name, and the file name chosen |
|
|
;; is a directory, don't exit the minibuffer. |
|
|
(if (and (eq minibuffer-completion-table 'read-file-name-internal) |
|
|
(file-directory-p (buffer-string))) |
|
|
(select-window (active-minibuffer-window)) |
|
|
(exit-minibuffer)))))) |
|
|
|
|
|
;; Accumulate in the cdr part of DECODE-MAP all pairs of key sequences |
|
|
;; vs the corresponding translations defined in the Quail map |
|
|
;; specified by the first element MAP-LIST. Each pair has the form |
|
|
;; (KEYSEQ . TRANSLATION). DECODE-MAP should have the form |
|
|
;; (decode-map . ALIST), where ALIST is an alist of length NUM. KEY |
|
|
;; is a key sequence to reach MAP. |
|
|
;; Optional 5th arg MAXNUM limits the number of accumulated pairs. |
|
|
;; Optional 6th arg IGNORES is a list of translations to ignore. |
|
2253 |
|
|
2254 |
(defun quail-build-decode-map (map-list key decode-map num |
(defun quail-build-decode-map (map-list key decode-map num |
2255 |
&optional maxnum ignores) |
&optional maxnum ignores) |
2256 |
|
"Build a decoding map. |
2257 |
|
Accumulate in the cdr part of DECODE-MAP all pairs of key sequences |
2258 |
|
vs the corresponding translations defined in the Quail map |
2259 |
|
specified by the first element MAP-LIST. Each pair has the form |
2260 |
|
\(KEYSEQ . TRANSLATION). DECODE-MAP should have the form |
2261 |
|
\(decode-map . ALIST), where ALIST is an alist of length NUM. KEY |
2262 |
|
is a key sequence to reach MAP. |
2263 |
|
Optional 5th arg MAXNUM limits the number of accumulated pairs. |
2264 |
|
Optional 6th arg IGNORES is a list of translations to ignore." |
2265 |
(let* ((map (car map-list)) |
(let* ((map (car map-list)) |
2266 |
(translation (quail-get-translation (car map) key (length key))) |
(translation (quail-get-translation (car map) key (length key))) |
2267 |
elt) |
elt) |
2299 |
decode-map num maxnum ignores)))) |
decode-map num maxnum ignores)))) |
2300 |
num))) |
num))) |
2301 |
|
|
|
;; Insert the pairs of key sequences vs the corresponding translations |
|
|
;; stored in DECODE-MAP by the concise format. DECODE-MAP should be |
|
|
;; made by `quail-build-decode-map' (which see). |
|
|
|
|
2302 |
(defun quail-insert-decode-map (decode-map) |
(defun quail-insert-decode-map (decode-map) |
2303 |
|
"Insert pairs of key sequences vs the corresponding translations. |
2304 |
|
These are stored in DECODE-MAP using the concise format. DECODE-MAP |
2305 |
|
should be made by `quail-build-decode-map' (which see)." |
2306 |
(setq decode-map |
(setq decode-map |
2307 |
(sort (cdr decode-map) |
(sort (cdr decode-map) |
2308 |
(function (lambda (x y) |
(function (lambda (x y) |
2503 |
---------------------------\n")) |
---------------------------\n")) |
2504 |
(help-setup-xref (list #'quail-help (quail-name)) |
(help-setup-xref (list #'quail-help (quail-name)) |
2505 |
(interactive-p)) |
(interactive-p)) |
2506 |
(setq quail-current-package nil) |
(setq quail-current-package nil) |
2507 |
;; Resize the help window again, now that it has all its contents. |
;; Resize the help window again, now that it has all its contents. |
2508 |
(save-selected-window |
(save-selected-window |
2509 |
(select-window (get-buffer-window (current-buffer))) |
(select-window (get-buffer-window (current-buffer))) |
2782 |
(with-temp-buffer |
(with-temp-buffer |
2783 |
(insert-file-contents (car pkg-list)) |
(insert-file-contents (car pkg-list)) |
2784 |
(goto-char (point-min)) |
(goto-char (point-min)) |
2785 |
(while (search-forward "(quail-define-package" nil t) |
;; Don't get fooled by commented-out code. |
2786 |
|
(while (search-forward "^[ \t]*(quail-define-package" nil t) |
2787 |
(goto-char (match-beginning 0)) |
(goto-char (match-beginning 0)) |
2788 |
(condition-case nil |
(condition-case nil |
2789 |
(let ((form (read (current-buffer)))) |
(let ((form (read (current-buffer)))) |
2820 |
(message "Updating %s ... done" leim-list))) |
(message "Updating %s ... done" leim-list))) |
2821 |
|
|
2822 |
(defun quail-advice (args) |
(defun quail-advice (args) |
2823 |
"Advice users about the characters input by the current Quail package. |
"Advise users about the characters input by the current Quail package. |
2824 |
The argument is a parameterized event of the form: |
The argument is a parameterized event of the form: |
2825 |
(quail-advice STRING) |
(quail-advice STRING) |
2826 |
where STRING is a string containing the input characters. |
where STRING is a string containing the input characters. |