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 |
(require 'help-mode) |
(require 'help-mode) |
669 |
aAsSdDfFgGhHjJkKlL;+:*]} \ |
aAsSdDfFgGhHjJkKlL;+:*]} \ |
670 |
zZxXcCvVbBnNmM,<.>/?\\_ \ |
zZxXcCvVbBnNmM,<.>/?\\_ \ |
671 |
") |
") |
672 |
|
'("pc105-uk" . "\ |
673 |
|
\ |
674 |
|
`\2541!2\3\243$5%6^7&8*9(0)-_=+ \ |
675 |
|
qQwWeErRtTyYuUiIoOpP[{]} \ |
676 |
|
aAsSdDfFgGhHjJkKlL;:'@#~ \ |
677 |
|
\\|zZxXcCvVbBnNmM,<.>/? \ |
678 |
|
") |
679 |
) |
) |
680 |
"Alist of keyboard names and corresponding layout strings. |
"Alist of keyboard names and corresponding layout strings. |
681 |
See the documentation of `quail-keyboard-layout' for the format of |
See the documentation of `quail-keyboard-layout' for the format of |
720 |
"Type of keyboard layout used in Quail base input method. |
"Type of keyboard layout used in Quail base input method. |
721 |
Available types are listed in the variable `quail-keyboard-layout-alist'." |
Available types are listed in the variable `quail-keyboard-layout-alist'." |
722 |
:group 'quail |
:group 'quail |
723 |
:type 'string |
:type (cons 'choice (mapcar (lambda (elt) |
724 |
|
(list 'const (car elt))) |
725 |
|
quail-keyboard-layout-alist)) |
726 |
:set #'(lambda (symbol value) |
:set #'(lambda (symbol value) |
727 |
(quail-update-keyboard-layout value) |
(quail-update-keyboard-layout value) |
728 |
(set symbol value))) |
(set symbol value))) |
1265 |
(defun quail-error (&rest args) |
(defun quail-error (&rest args) |
1266 |
(signal 'quail-error (apply 'format args))) |
(signal 'quail-error (apply 'format args))) |
1267 |
|
|
|
|
|
1268 |
(defun quail-input-string-to-events (str) |
(defun quail-input-string-to-events (str) |
1269 |
"Convert input string STR to a list of events. |
"Convert input string STR to a list of events. |
1270 |
Do so while interleaving with the following special events: |
Do so while interleaving with the following special events: |
1271 |
\(compose-last-chars LEN COMPONENTS) |
\(compose-last-chars LEN COMPONENTS) |
1272 |
\(quail-advice INPUT-STRING)" |
\(quail-advice INPUT-STRING)" |
1273 |
(let* ((events (string-to-list str)) |
(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))) |
1279 |
(len (length str)) |
(len (length str)) |
1280 |
(idx len) |
(idx len) |
1281 |
composition from to) |
composition from to) |
2193 |
(setq i (1+ i))) |
(setq i (1+ i))) |
2194 |
(insert "\n"))))) |
(insert "\n"))))) |
2195 |
|
|
|
;; Choose a completion in *Quail Completions* buffer with mouse-2. |
|
|
|
|
2196 |
(defun quail-mouse-choose-completion (event) |
(defun quail-mouse-choose-completion (event) |
2197 |
"Click on an alternative in the `*Quail Completions*' buffer to choose it." |
"Click on an alternative in the `*Quail Completions*' buffer to choose it." |
2198 |
(interactive "e") |
(interactive "e") |
2200 |
;; `mouse-choose-completion' except that we: |
;; `mouse-choose-completion' except that we: |
2201 |
;; 1) add two lines from `choose-completion' in simple.el to give |
;; 1) add two lines from `choose-completion' in simple.el to give |
2202 |
;; the `mouse-2' click a little more leeway. |
;; the `mouse-2' click a little more leeway. |
2203 |
;; 2) don't bury *Quail Completions* buffer so comment a section, and |
;; 2) don't bury *Quail Completions* buffer, so comment a section, and |
2204 |
;; 3) delete/terminate the current quail selection here. |
;; 3) delete/terminate the current quail selection here. |
2205 |
;; Give temporary modes such as isearch a chance to turn off. |
;; Give temporary modes such as isearch a chance to turn off. |
2206 |
(run-hooks 'mouse-leave-buffer-hook) |
(run-hooks 'mouse-leave-buffer-hook) |
2237 |
(quail-choose-completion-string choice buffer base-size) |
(quail-choose-completion-string choice buffer base-size) |
2238 |
(quail-terminate-translation))) |
(quail-terminate-translation))) |
2239 |
|
|
2240 |
;; Modify the simple.el function `choose-completion-string', because |
;; BASE-SIZE here is for compatibility with an (unused) arg of a |
2241 |
;; the simple.el function `choose-completion-delete-max-match' breaks |
;; previous implementation. |
|
;; on Mule data, since the semantics of `forward-char' have changed. |
|
|
|
|
2242 |
(defun quail-choose-completion-string (choice &optional buffer base-size) |
(defun quail-choose-completion-string (choice &optional buffer base-size) |
2243 |
(let ((buffer (or buffer completion-reference-buffer))) |
(setq quail-current-str choice) |
2244 |
;; If BUFFER is a minibuffer, barf unless it's the currently |
(choose-completion-string choice buffer)) |
|
;; 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)))))) |
|
2245 |
|
|
2246 |
(defun quail-build-decode-map (map-list key decode-map num |
(defun quail-build-decode-map (map-list key decode-map num |
2247 |
&optional maxnum ignores) |
&optional maxnum ignores) |
2780 |
(with-temp-buffer |
(with-temp-buffer |
2781 |
(insert-file-contents (car pkg-list)) |
(insert-file-contents (car pkg-list)) |
2782 |
(goto-char (point-min)) |
(goto-char (point-min)) |
2783 |
(while (search-forward "(quail-define-package" nil t) |
;; Don't get fooled by commented-out code. |
2784 |
|
(while (re-search-forward "^[ \t]*(quail-define-package" nil t) |
2785 |
(goto-char (match-beginning 0)) |
(goto-char (match-beginning 0)) |
2786 |
(condition-case nil |
(condition-case nil |
2787 |
(let ((form (read (current-buffer)))) |
(let ((form (read (current-buffer)))) |