Mercurial > emacs
comparison lisp/international/quail.el @ 42048:281baedc1a99
(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.
author | Dave Love <fx@gnu.org> |
---|---|
date | Sat, 15 Dec 2001 16:40:33 +0000 |
parents | 63a5d03689eb |
children | 5d63f6ad7711 |
comparison
equal
deleted
inserted
replaced
42047:83eb799f3657 | 42048:281baedc1a99 |
---|---|
5 ;; Copyright (C) 2001 Free Software Foundation, Inc. | 5 ;; Copyright (C) 2001 Free Software Foundation, Inc. |
6 | 6 |
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 |
14 ;; GNU Emacs is free software; you can redistribute it and/or modify | 14 ;; GNU Emacs is free software; you can redistribute it and/or modify |
15 ;; it under the terms of the GNU General Public License as published by | 15 ;; it under the terms of the GNU General Public License as published by |
39 ;; text. For instance, Quail package for Japanese (`quail-jp') | 39 ;; text. For instance, Quail package for Japanese (`quail-jp') |
40 ;; translates Roman text (transliteration of Japanese in Latin | 40 ;; translates Roman text (transliteration of Japanese in Latin |
41 ;; alphabets) to Hiragana text, which is then converted to | 41 ;; alphabets) to Hiragana text, which is then converted to |
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 | |
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.] | |
44 | 52 |
45 ;;; Code: | 53 ;;; Code: |
46 | 54 |
47 (require 'help-mode) | 55 (require 'help-mode) |
48 | 56 |
659 1!2\"3#4$5%6&7'8(9)0~-=^~\\| \ | 667 1!2\"3#4$5%6&7'8(9)0~-=^~\\| \ |
660 qQwWeErRtTyYuUiIoOpP@`[{ \ | 668 qQwWeErRtTyYuUiIoOpP@`[{ \ |
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 |
667 the layout string.") | 682 the layout string.") |
668 | 683 |
703 | 718 |
704 (defcustom quail-keyboard-layout-type "standard" | 719 (defcustom quail-keyboard-layout-type "standard" |
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))) |
712 | 729 |
713 ;;;###autoload | 730 ;;;###autoload |
1246 | 1263 |
1247 (put 'quail-error 'error-conditions '(quail-error error)) | 1264 (put 'quail-error 'error-conditions '(quail-error error)) |
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) |
1261 (while (and (> idx 0) | 1282 (while (and (> idx 0) |
1262 (setq composition (find-composition idx 0 str t))) | 1283 (setq composition (find-composition idx 0 str t))) |
2170 ;; Passing the mouse over a character will highlight. | 2191 ;; Passing the mouse over a character will highlight. |
2171 (put-text-property beg (point) 'mouse-face 'highlight) | 2192 (put-text-property beg (point) 'mouse-face 'highlight) |
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") |
2180 ;; This function is an exact copy of the mouse.el function | 2199 ;; This function is an exact copy of the mouse.el function |
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) |
2188 (let ((buffer (window-buffer)) | 2207 (let ((buffer (window-buffer)) |
2189 choice | 2208 choice |
2216 ; (select-window owindow)) | 2235 ; (select-window owindow)) |
2217 (quail-delete-region) | 2236 (quail-delete-region) |
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) |
2258 "Build a decoding map. | 2248 "Build a decoding map. |
2259 Accumulate in the cdr part of DECODE-MAP all pairs of key sequences | 2249 Accumulate in the cdr part of DECODE-MAP all pairs of key sequences |
2788 (while pkg-list | 2778 (while pkg-list |
2789 (message "Checking %s ..." (car pkg-list)) | 2779 (message "Checking %s ..." (car pkg-list)) |
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)))) |
2797 (with-current-buffer list-buf | 2788 (with-current-buffer list-buf |
2798 (insert | 2789 (insert |