Mercurial > emacs
comparison lisp/international/quail.el @ 19675:32c3f7d9ef10
(quail-keyboard-layout-alist): Add an
entry for "atari-german".
(quail-keyboard-translate): If CH is not in the keyboard location
covered by quail-keyboard-layout-standard, return CH.
(quail-show-kbd-layout): Show keyboard layout based on
quail-keyboard-layout-standard if the current input method
requires keyboard translation.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Tue, 02 Sep 1997 10:49:43 +0000 |
parents | 47d11f4bbc6c |
children | 3ada64a43911 |
comparison
equal
deleted
inserted
replaced
19674:2273b4030beb | 19675:32c3f7d9ef10 |
---|---|
649 1!2@3#4$5%6^7&8*9(0)-_=+\\|`~\ | 649 1!2@3#4$5%6^7&8*9(0)-_=+\\|`~\ |
650 qQwWeErRtTyYuUiIoOpP[{]} \ | 650 qQwWeErRtTyYuUiIoOpP[{]} \ |
651 aAsSdDfFgGhHjJkKlL;:'\" \ | 651 aAsSdDfFgGhHjJkKlL;:'\" \ |
652 zZxXcCvVbBnNmM,<.>/? \ | 652 zZxXcCvVbBnNmM,<.>/? \ |
653 ") | 653 ") |
654 '("atari-german" . "\ | |
655 \ | |
656 1!2\"3\2474$5%6&7/8(9)0=\337?'`#^ \ | |
657 qQwWeErRtTzZuUiIoOpP\374\334+* \ | |
658 aAsSdDfFgGhHjJkKlL\366\326\344\304~| \ | |
659 <>yYxXcCvVbBnNmM,;.:-_ \ | |
660 ") | |
654 (cons "standard" quail-keyboard-layout-standard)) | 661 (cons "standard" quail-keyboard-layout-standard)) |
655 "Alist of keyboard names and corresponding layout strings. | 662 "Alist of keyboard names and corresponding layout strings. |
656 See the documentation of `quail-keyboard-layout' for the format of | 663 See the documentation of `quail-keyboard-layout' for the format of |
657 the layout string.") | 664 the layout string.") |
658 | 665 |
677 (setq quail-keyboard-layout (cdr layout)))) | 684 (setq quail-keyboard-layout (cdr layout)))) |
678 | 685 |
679 (defun quail-keyboard-translate (ch) | 686 (defun quail-keyboard-translate (ch) |
680 "Translate CHAR according to `quail-keyboard-layout' and return the result." | 687 "Translate CHAR according to `quail-keyboard-layout' and return the result." |
681 (if (eq quail-keyboard-layout quail-keyboard-layout-standard) | 688 (if (eq quail-keyboard-layout quail-keyboard-layout-standard) |
689 ;; All Quail packages are designed based on | |
690 ;; `quail-keyboard-layout-standard'. | |
682 ch | 691 ch |
683 (let ((i 0)) | 692 (let ((i 0)) |
684 (while (and (< i quail-keyboard-layout-len) | 693 (while (and (< i quail-keyboard-layout-len) |
685 (/= ch (aref quail-keyboard-layout i))) | 694 (/= ch (aref quail-keyboard-layout i))) |
686 (setq i (1+ i))) | 695 (setq i (1+ i))) |
687 (if (= i quail-keyboard-layout-len) | 696 (if (= i quail-keyboard-layout-len) |
688 (error "Character `%c' not found in your keyboard layout" ch)) | 697 ;; CH is not in quail-keyboard-layout, which means that a |
689 (aref quail-keyboard-layout-standard i)))) | 698 ;; user typed a key which generated a character code to be |
699 ;; handled out of Quail. Just return CH and make | |
700 ;; quail-execute-non-quail-command handle it correctly. | |
701 ch | |
702 (let ((char (aref quail-keyboard-layout-standard i))) | |
703 (if (= char ?\ ) | |
704 ;; A user typed a key at the location not convered by | |
705 ;; quail-keyboard-layout-standard. Just return CH as | |
706 ;; well as above. | |
707 ch | |
708 char)))))) | |
690 | 709 |
691 ;; Quail map | 710 ;; Quail map |
692 | 711 |
693 (defsubst quail-map-p (object) | 712 (defsubst quail-map-p (object) |
694 "Return t if OBJECT is a Quail map. | 713 "Return t if OBJECT is a Quail map. |
1672 (newline) | 1691 (newline) |
1673 (indent-to (/ i 30))) | 1692 (indent-to (/ i 30))) |
1674 (if (= (% i 2) 0) | 1693 (if (= (% i 2) 0) |
1675 (insert " "))) | 1694 (insert " "))) |
1676 (setq ch (aref quail-keyboard-layout i)) | 1695 (setq ch (aref quail-keyboard-layout i)) |
1677 (if (= ch ?\ ) | 1696 (when (and (quail-kbd-translate) |
1678 (insert ch) | 1697 (/= ch ?\ )) |
1679 (let* ((map (cdr (assq ch (cdr (quail-map))))) | 1698 ;; This is the case that the current input method simulates |
1680 (translation (and map (quail-get-translation | 1699 ;; some keyboard layout (which means it requires keyboard |
1681 (car map) (char-to-string ch) 1)))) | 1700 ;; translation) and a key at location `i' exists on users |
1682 (if (integerp translation) | 1701 ;; keyboard. We must translate that key by |
1683 (insert translation) | 1702 ;; `quail-keyboard-layout-standard'. But if if there's no |
1684 (if (consp translation) | 1703 ;; corresponding key in that standard layout, we must simulate |
1685 (insert (aref (cdr translation) (car translation))) | 1704 ;; what is inserted if that key is pressed by setting CH a |
1686 (insert ch))))) | 1705 ;; minus value. |
1706 (setq ch (aref quail-keyboard-layout-standard i)) | |
1707 (if (= ch ?\ ) | |
1708 (setq ch (- (aref quail-keyboard-layout i))))) | |
1709 (if (< ch 0) | |
1710 (let ((last-command-event (- ch))) | |
1711 (self-insert-command 1)) | |
1712 (if (= ch ?\ ) | |
1713 (insert ch) | |
1714 (let* ((map (cdr (assq ch (cdr (quail-map))))) | |
1715 (translation (and map (quail-get-translation | |
1716 (car map) (char-to-string ch) 1)))) | |
1717 (if (integerp translation) | |
1718 (insert translation) | |
1719 (if (consp translation) | |
1720 (insert (aref (cdr translation) (car translation))) | |
1721 (let ((last-command-event ch)) | |
1722 (self-insert-command 1))))))) | |
1687 (setq i (1+ i)))) | 1723 (setq i (1+ i)))) |
1688 (newline)) | 1724 (newline)) |
1689 | 1725 |
1690 (defun quail-translation-help () | 1726 (defun quail-translation-help () |
1691 "Show help message while translating in Quail mode." | 1727 "Show help message while translating in Quail mode." |