diff options
| author | Dave Love | 2001-12-15 16:40:33 +0000 |
|---|---|---|
| committer | Dave Love | 2001-12-15 16:40:33 +0000 |
| commit | 35fffde1df8d896c964b6d3b42fff70f4dd1c49b (patch) | |
| tree | 399b37e6362cbecae115bb9470dac5f03b02a0ce | |
| parent | bdf74befa8f8a70301b9c401872458eec2ed4a25 (diff) | |
| download | emacs-35fffde1df8d896c964b6d3b42fff70f4dd1c49b.tar.gz emacs-35fffde1df8d896c964b6d3b42fff70f4dd1c49b.zip | |
(quail-keyboard-layout-alist): Add
pc105-uk.
(quail-keyboard-layout-type): Fix :type.
(quail-choose-completion-string): Simplify.
(quail-update-leim-list-file): Don't get fooled by commented-out
code.
(quail-input-string-to-events): Run events through
translation-table-for-input.
| -rw-r--r-- | lisp/international/quail.el | 73 |
1 files changed, 32 insertions, 41 deletions
diff --git a/lisp/international/quail.el b/lisp/international/quail.el index ecf18cf453a..5155f363b66 100644 --- a/lisp/international/quail.el +++ b/lisp/international/quail.el | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | ;; Author: Kenichi HANDA <handa@etl.go.jp> | 7 | ;; Author: Kenichi HANDA <handa@etl.go.jp> |
| 8 | ;; Naoto TAKAHASHI <ntakahas@etl.go.jp> | 8 | ;; Naoto TAKAHASHI <ntakahas@etl.go.jp> |
| 9 | ;; Maintainer: Kenichi HANDA <handa@etl.go.jp> | 9 | ;; Maintainer: Kenichi HANDA <handa@etl.go.jp> |
| 10 | ;; Keywords: mule, multilingual, input method | 10 | ;; Keywords: mule, multilingual, input method, i18n |
| 11 | 11 | ||
| 12 | ;; This file is part of GNU Emacs. | 12 | ;; This file is part of GNU Emacs. |
| 13 | 13 | ||
| @@ -42,6 +42,14 @@ | |||
| 42 | ;; Kanji-and-Kana mixed text or Katakana text by commands specified in | 42 | ;; Kanji-and-Kana mixed text or Katakana text by commands specified in |
| 43 | ;; CONVERSION-KEYS argument of the Quail package. | 43 | ;; CONVERSION-KEYS argument of the Quail package. |
| 44 | 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 | |||
| 45 | ;;; Code: | 53 | ;;; Code: |
| 46 | 54 | ||
| 47 | (require 'help-mode) | 55 | (require 'help-mode) |
| @@ -661,6 +669,13 @@ The command `quail-set-keyboard-layout' usually sets this variable.") | |||
| 661 | aAsSdDfFgGhHjJkKlL;+:*]} \ | 669 | aAsSdDfFgGhHjJkKlL;+:*]} \ |
| 662 | zZxXcCvVbBnNmM,<.>/?\\_ \ | 670 | zZxXcCvVbBnNmM,<.>/?\\_ \ |
| 663 | ") | 671 | ") |
| 672 | '("pc105-uk" . "\ | ||
| 673 | \ | ||
| 674 | `\2541!2\3\243$5%6^7&8*9(0)-_=+ \ | ||
| 675 | qQwWeErRtTyYuUiIoOpP[{]} \ | ||
| 676 | aAsSdDfFgGhHjJkKlL;:'@#~ \ | ||
| 677 | \\|zZxXcCvVbBnNmM,<.>/? \ | ||
| 678 | ") | ||
| 664 | ) | 679 | ) |
| 665 | "Alist of keyboard names and corresponding layout strings. | 680 | "Alist of keyboard names and corresponding layout strings. |
| 666 | See the documentation of `quail-keyboard-layout' for the format of | 681 | See the documentation of `quail-keyboard-layout' for the format of |
| @@ -705,7 +720,9 @@ the layout string.") | |||
| 705 | "Type of keyboard layout used in Quail base input method. | 720 | "Type of keyboard layout used in Quail base input method. |
| 706 | Available types are listed in the variable `quail-keyboard-layout-alist'." | 721 | Available types are listed in the variable `quail-keyboard-layout-alist'." |
| 707 | :group 'quail | 722 | :group 'quail |
| 708 | :type 'string | 723 | :type (cons 'choice (mapcar (lambda (elt) |
| 724 | (list 'const (car elt))) | ||
| 725 | quail-keyboard-layout-alist)) | ||
| 709 | :set #'(lambda (symbol value) | 726 | :set #'(lambda (symbol value) |
| 710 | (quail-update-keyboard-layout value) | 727 | (quail-update-keyboard-layout value) |
| 711 | (set symbol value))) | 728 | (set symbol value))) |
| @@ -1248,13 +1265,17 @@ The returned value is a Quail map specific to KEY." | |||
| 1248 | (defun quail-error (&rest args) | 1265 | (defun quail-error (&rest args) |
| 1249 | (signal 'quail-error (apply 'format args))) | 1266 | (signal 'quail-error (apply 'format args))) |
| 1250 | 1267 | ||
| 1251 | |||
| 1252 | (defun quail-input-string-to-events (str) | 1268 | (defun quail-input-string-to-events (str) |
| 1253 | "Convert input string STR to a list of events. | 1269 | "Convert input string STR to a list of events. |
| 1254 | Do so while interleaving with the following special events: | 1270 | Do so while interleaving with the following special events: |
| 1255 | \(compose-last-chars LEN COMPONENTS) | 1271 | \(compose-last-chars LEN COMPONENTS) |
| 1256 | \(quail-advice INPUT-STRING)" | 1272 | \(quail-advice INPUT-STRING)" |
| 1257 | (let* ((events (string-to-list str)) | 1273 | (let* ((events (lambda (c) |
| 1274 | ;; This gives us the chance to unify on input | ||
| 1275 | ;; (e.g. using ucs-tables.el). | ||
| 1276 | (or (and translation-table-for-input | ||
| 1277 | (aref translation-table-for-input c)) | ||
| 1278 | c))) | ||
| 1258 | (len (length str)) | 1279 | (len (length str)) |
| 1259 | (idx len) | 1280 | (idx len) |
| 1260 | composition from to) | 1281 | composition from to) |
| @@ -2172,8 +2193,6 @@ are shown (at most to the depth specified `quail-completion-max-depth')." | |||
| 2172 | (setq i (1+ i))) | 2193 | (setq i (1+ i))) |
| 2173 | (insert "\n"))))) | 2194 | (insert "\n"))))) |
| 2174 | 2195 | ||
| 2175 | ;; Choose a completion in *Quail Completions* buffer with mouse-2. | ||
| 2176 | |||
| 2177 | (defun quail-mouse-choose-completion (event) | 2196 | (defun quail-mouse-choose-completion (event) |
| 2178 | "Click on an alternative in the `*Quail Completions*' buffer to choose it." | 2197 | "Click on an alternative in the `*Quail Completions*' buffer to choose it." |
| 2179 | (interactive "e") | 2198 | (interactive "e") |
| @@ -2181,7 +2200,7 @@ are shown (at most to the depth specified `quail-completion-max-depth')." | |||
| 2181 | ;; `mouse-choose-completion' except that we: | 2200 | ;; `mouse-choose-completion' except that we: |
| 2182 | ;; 1) add two lines from `choose-completion' in simple.el to give | 2201 | ;; 1) add two lines from `choose-completion' in simple.el to give |
| 2183 | ;; the `mouse-2' click a little more leeway. | 2202 | ;; the `mouse-2' click a little more leeway. |
| 2184 | ;; 2) don't bury *Quail Completions* buffer so comment a section, and | 2203 | ;; 2) don't bury *Quail Completions* buffer, so comment a section, and |
| 2185 | ;; 3) delete/terminate the current quail selection here. | 2204 | ;; 3) delete/terminate the current quail selection here. |
| 2186 | ;; Give temporary modes such as isearch a chance to turn off. | 2205 | ;; Give temporary modes such as isearch a chance to turn off. |
| 2187 | (run-hooks 'mouse-leave-buffer-hook) | 2206 | (run-hooks 'mouse-leave-buffer-hook) |
| @@ -2218,40 +2237,11 @@ are shown (at most to the depth specified `quail-completion-max-depth')." | |||
| 2218 | (quail-choose-completion-string choice buffer base-size) | 2237 | (quail-choose-completion-string choice buffer base-size) |
| 2219 | (quail-terminate-translation))) | 2238 | (quail-terminate-translation))) |
| 2220 | 2239 | ||
| 2221 | ;; Modify the simple.el function `choose-completion-string', because | 2240 | ;; BASE-SIZE here is for compatibility with an (unused) arg of a |
| 2222 | ;; the simple.el function `choose-completion-delete-max-match' breaks | 2241 | ;; previous implementation. |
| 2223 | ;; on Mule data, since the semantics of `forward-char' have changed. | ||
| 2224 | |||
| 2225 | (defun quail-choose-completion-string (choice &optional buffer base-size) | 2242 | (defun quail-choose-completion-string (choice &optional buffer base-size) |
| 2226 | (let ((buffer (or buffer completion-reference-buffer))) | 2243 | (setq quail-current-str choice) |
| 2227 | ;; If BUFFER is a minibuffer, barf unless it's the currently | 2244 | (choose-completion-string choice buffer)) |
| 2228 | ;; active minibuffer. | ||
| 2229 | (if (and (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" (buffer-name buffer)) | ||
| 2230 | (or (not (active-minibuffer-window)) | ||
| 2231 | (not (equal buffer | ||
| 2232 | (window-buffer (active-minibuffer-window)))))) | ||
| 2233 | (quail-error "Minibuffer is not active for completion") | ||
| 2234 | ;; Store the completion in `quail-current-str', which will later | ||
| 2235 | ;; be converted to a character event list, then inserted into | ||
| 2236 | ;; the buffer where completion was requested. | ||
| 2237 | (set-buffer buffer) | ||
| 2238 | ; (if base-size | ||
| 2239 | ; (delete-region (+ base-size (point-min)) (point)) | ||
| 2240 | ; (choose-completion-delete-max-match choice)) | ||
| 2241 | (setq quail-current-str choice) | ||
| 2242 | ;; Update point in the window that BUFFER is showing in. | ||
| 2243 | (let ((window (get-buffer-window buffer t))) | ||
| 2244 | (set-window-point window (point))) | ||
| 2245 | ;; If completing for the minibuffer, exit it with this choice. | ||
| 2246 | (and (not completion-no-auto-exit) | ||
| 2247 | (equal buffer (window-buffer (minibuffer-window))) | ||
| 2248 | minibuffer-completion-table | ||
| 2249 | ;; If this is reading a file name, and the file name chosen | ||
| 2250 | ;; is a directory, don't exit the minibuffer. | ||
| 2251 | (if (and (eq minibuffer-completion-table 'read-file-name-internal) | ||
| 2252 | (file-directory-p (buffer-string))) | ||
| 2253 | (select-window (active-minibuffer-window)) | ||
| 2254 | (exit-minibuffer)))))) | ||
| 2255 | 2245 | ||
| 2256 | (defun quail-build-decode-map (map-list key decode-map num | 2246 | (defun quail-build-decode-map (map-list key decode-map num |
| 2257 | &optional maxnum ignores) | 2247 | &optional maxnum ignores) |
| @@ -2790,7 +2780,8 @@ of each directory." | |||
| 2790 | (with-temp-buffer | 2780 | (with-temp-buffer |
| 2791 | (insert-file-contents (car pkg-list)) | 2781 | (insert-file-contents (car pkg-list)) |
| 2792 | (goto-char (point-min)) | 2782 | (goto-char (point-min)) |
| 2793 | (while (search-forward "(quail-define-package" nil t) | 2783 | ;; Don't get fooled by commented-out code. |
| 2784 | (while (re-search-forward "^[ \t]*(quail-define-package" nil t) | ||
| 2794 | (goto-char (match-beginning 0)) | 2785 | (goto-char (match-beginning 0)) |
| 2795 | (condition-case nil | 2786 | (condition-case nil |
| 2796 | (let ((form (read (current-buffer)))) | 2787 | (let ((form (read (current-buffer)))) |