• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/international/

Lines Matching +defs:end +defs:of +defs:input

1 ;;; quail.el --- provides simple input method for multilingual text
7 ;; National Institute of Advanced Industrial Science and Technology (AIST)
13 ;; Keywords: mule, multilingual, input method, i18n
15 ;; This file is part of GNU Emacs.
18 ;; it under the terms of the GNU General Public License as published by
23 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
27 ;; You should have received a copy of the GNU General Public License
34 ;; In Quail minor mode, you can input multilingual text easily. By
36 ;; string to multilingual character or string, you can input any text
41 ;; process of converting a translated text to some more desirable
43 ;; translates Roman text (transliteration of Japanese in Latin
46 ;; CONVERSION-KEYS argument of the Quail package.
48 ;; [There was an input method for Mule 2.3 called `Tamago' from the
53 ;; Japan. Maybe others will be egged on to write more sorts of input
61 "Quail: multilingual input method."
67 "The current Quail package, which depends on the current input method.
68 See the documentation of `quail-package-alist' for the format.")
75 ;; A buffer to show completion list of the current key sequence.
87 "Overlay which covers the current translation region of Quail.")
99 "Currently selected translation of the current key.")
103 "Cons of indices and vector of possible translations of the current key.
104 Indices is a list of (CURRENT START END BLOCK BLOCKS), where
105 CURRENT is an index of the current translation,
106 START and END are indices of the start and end of the current block,
108 BLOCKS is a number of blocks of translation.")
112 "Any Lisp object holding information of current translation status.
114 of actual translation and some Lisp object to be referred
122 "List of Quail packages.
123 A Quail package is a list of these elements:
130 the format, see the documentation of `quail-map-p'.
132 DECODE-MAP is an alist of translations and corresponding keys.
134 See the documentation of `quail-define-package' for the other elements.")
139 "Return the name of the current Quail package."
143 "Return the title of the current Quail package."
147 ;; of the list is the same as that of mode-line-format.
161 "Return the translation map of the current Quail package."
164 "Return an object used for `guidance' feature of the current Quail package.
165 See also the documentation of `quail-define-package'."
168 "Return the documentation string of the current Quail package."
175 "Return `forget-last-selection' flag of the current Quail package.
176 See also the documentation of `quail-define-package'."
179 "Return `deterministic' flag of the current Quail package.
180 See also the documentation of `quail-define-package'."
183 "Return `kbd-translate' flag of the current Quail package.
184 See also the documentation of `quail-define-package'."
187 "Return `show-layout' flag of the current Quail package.
188 See also the documentation of `quail-define-package'."
191 "Return decode map of the current Quail package.
192 It is an alist of translations and corresponding keys."
195 "Return `maximum-shortest' flag of the current Quail package.
196 See also the documentation of `quail-define-package'."
199 "Return property list of an overly used in the current Quail package."
238 This activates input method defined by PACKAGE-NAME by running
254 libraries in LEIM (Libraries of Emacs Input Method) which is
261 (setq current-input-method-title (quail-title))
303 Only a few especially complex input methods use this map;
310 can select one of the characters shown by typing the corresponding
318 to the next group of ten, and C-p to move back to the previous group
319 of ten.")
321 ;; Categorize each Quail commands to make the output of quail-help
325 ;; non-deterministic -- show only for non-deterministic input method
358 A few especially complex input methods use `quail-translation-keymap' instead.
373 (define-key map "\C-a" 'quail-conversion-beginning-of-region)
374 (define-key map "\C-e" 'quail-conversion-end-of-region)
399 "Define NAME as a new Quail package for input LANGUAGE.
407 If it is t, list of all possible translations for the current key is shown
414 DOCSTRING is the documentation string of this package. The command
415 `describe-input-method' shows this string while replacing the form
416 \\=\\<VAR> in the string by the value of VAR. That value should be a
419 list of candidates.
422 region is active. It is an alist of single key character vs. corresponding
430 DETERMINISTIC non-nil means the first candidate of translation is
432 translation for a key. In this case, unselected translations are of
433 no use for an interactive use of Quail but can be used by some other
437 KBD-TRANSLATE non-nil means input characters are translated from a
439 documentation of `quail-keyboard-layout' and
448 map is an alist of translations and corresponding original keys.
455 length of the shortest sequence. When we don't have a translation of
456 key \"..ABCD\" but have translations of \"..AB\" and \"CD..\", break
457 the key at \"..AB\" and start translation of \"CD..\". Hangul
459 break the key just at \"..ABC\" and start translation of \"D..\".
470 conversion region is active. It is an alist of single key character
473 If SIMPLE is non-nil, then we do not alter the meanings of
504 ;; Update input-method-alist.
505 (let ((slot (assoc name input-method-alist))
508 (setq input-method-alist (cons (cons name val) input-method-alist)))))
520 (if input-method-highlight-flag
531 (if input-method-highlight-flag
542 "Inactivate Quail input method.
549 "Activate Quail input method.
550 With arg, activate Quail input method if and only if arg is positive.
552 This function runs `quail-activate-hook' if it activates the input
555 While this input method is active, the variable
556 `input-method-function' is bound to the function `quail-input-method'."
559 ;; Let's inactivate Quail input method.
563 (setq describe-current-input-method-function nil)
567 (kill-local-variable 'input-method-function))
568 ;; Let's activate Quail input method.
576 (setq inactivate-current-input-method-function 'quail-inactivate)
577 (setq describe-current-input-method-function 'quail-help)
581 ;; If we are in minibuffer, turn off the current input method
587 (make-local-variable 'input-method-function)
588 (setq input-method-function 'quail-input-method)))
591 (inactivate-input-method)
599 ;; is locations of keys the user entered, not character codes
602 ;; information of his own keyboard layout, then translate it to the
614 "Standard keyboard layout of printable characters Quail assumes.
615 See the documentation of `quail-keyboard-layout' for this format.
616 This layout is almost the same as that of VT100,
617 but the location of key \\ (backslash) is just right of key ' (single-quote),
618 not right of RETURN key.")
622 ;; Here we provide several examples of famous keyboard layouts.
665 "Alist of keyboard names and corresponding layout strings.
666 See the documentation of `quail-keyboard-layout' for the format of
670 "A string which represents physical key layout of a particular keyboard.
673 the first column of the second row is left of key `1',
674 the first column of the third row is left of key `q',
675 the first column of the fourth row is left of key `a',
676 the first column of the fifth row is left of key `z',
680 The location of Nth character is row (N / 30) and column ((N mod 30) / 2).
689 ;; A non-standard keyboard layout may miss some key locations of the
725 "Type of keyboard layout used in Quail base input method.
739 Since some Quail packages depends on a physical layout of keys (not
742 function tells Quail system the layout of your keyboard so that what
766 ;; handled out of Quail. Just return CHAR and make
773 ;; for the other location of the standard layout.
787 The format of KBD-LAYOUT is the same as `quail-keyboard-layout'."
814 ;; for a upper key. If width of L (U) is greater than 1,
839 ;; beginning and end of each line.
850 (delete-region (point) (match-end 0))
853 (subst-char-in-region (point) (match-end 0) ?| ? ))
855 (if (re-search-forward "\\( |\\)+$" (line-end-position) t)
857 (beginning-of-line))
858 ;; Calculate the start and end columns of a horizontal line.
863 (end-of-line)
869 (beginning-of-line))
897 "Show the physical layout of the keyboard type KEYBOARD-TYPE.
925 In the latter case, each element of VECTOR is a candidate for the translation,
928 ALIST is normally a list of elements that look like (CHAR . DEFN),
930 current key). It may also be a symbol of a function which returns an
931 alist of the above format.
934 vector. Then each element of the string or vector is a candidate for
949 "Define translation rules of the current Quail package.
950 Each argument is a list of KEY and TRANSLATION.
951 KEY is a string meaning a sequence of keystrokes to be translated.
953 If it is a character, it is the sole translation of KEY.
962 The first argument may be an alist of annotations for the following
968 be appended to the rules of the current Quail package.
973 advice -- the value is a function to call after one of RULES is
982 ;; If the first argument is an alist of annotations, handle them.
1029 Optional 2nd arg NAME, if non-nil, is a name of Quail package for
1043 Optional 2nd arg NAME, if non-nil, is a name of Quail package for
1060 KEY is a string meaning a sequence of keystrokes to be translated.
1063 It it is a character, it is the sole translation of KEY.
1067 If it is a cons, the car is one of the above and the cdr is a function
1081 to the current translations for KEY instead of replacing them."
1094 current translations for KEY instead of replacing them.
1149 ;; to a vector of strings, add PROPS to each string and record
1185 "Return the translation specified as DEF for KEY of length LEN.
1186 The translation is either a character or a cons of the form (INDEX . VECTOR),
1187 where VECTOR is a vector of candidates (character or string) for
1192 ;; DEF is a symbol of a function which returns valid translation.
1211 ;; Each character in DEF is a candidate of translation. Reform
1216 ;; If the length is 1, and the length of element string is 1, we
1221 ;; Each element (string or character) in DEF is a candidate of
1229 "Lookup KEY of length LEN in the current Quail map and return the definition.
1254 ;; We must reflect TRANSLATION to car part of DEF.
1261 ;; We must reflect TRANSLATION to car part of MAP.
1268 ;; We may have to reform cdr part of MAP.
1277 (defun quail-input-string-to-events (str)
1278 "Convert input string STR to a list of events.
1284 ;; This gives us the chance to unify on input
1286 (or (and translation-table-for-input
1287 (aref translation-table-for-input c))
1311 (defun quail-input-method (key)
1321 (let ((input-string (if (quail-conversion-keymap)
1325 (when (and (stringp input-string)
1326 (> (length input-string) 0))
1327 (if input-method-exit-on-first-char
1328 (list (aref input-string 0))
1329 (quail-input-string-to-events input-string))))
1332 ;; Run this hook only when the current input method doesn't require
1336 (run-hooks 'input-method-after-insert-chunk-hook))))))
1340 (end (overlay-end overlay)))
1341 (if (< start end)
1343 (string-to-list (buffer-substring start end))
1344 (delete-region start end)))))
1347 "Delete the text in the current translation region of Quail."
1350 (overlay-end quail-overlay))))
1353 "Start translation of the typed character KEY by the current Quail package.
1354 Return the input string."
1355 ;; Check the possibility of translating KEY.
1367 (input-method-function nil)
1378 (let* ((prompt (if input-method-use-echo-area
1380 (or input-method-previous-message "")
1411 "Start conversion of the typed character KEY by the current Quail package.
1412 Return the input string."
1413 ;; Check the possibility of translating KEY.
1425 (input-method-function nil)
1444 (let* ((prompt (if input-method-use-echo-area
1446 (or input-method-previous-message "")
1469 (if (or input-method-exit-on-first-char
1480 (overlay-end quail-conv-overlay)))
1491 "Terminate the translation of the current key."
1502 If CONTROL-FLAG is integer value, it is the number of keys in the
1518 (or input-method-exit-on-first-char
1530 (if (and input-method-exit-on-first-char
1533 (or input-method-use-echo-area
1553 (message "Can't input %c in the current unibyte buffer" char)
1564 (if (< (overlay-end quail-conv-overlay) (point))
1588 "Return the actual definition part of Quail map MAP."
1597 "Return string to be shown as current translation of key sequence.
1598 LEN is the length of the sequence. DEF is a definition part of the
1627 (end (nth 2 indices)))
1628 ;; Validate the index number of current translation.
1635 (if (or (null end) ; We have not yet calculated END.
1637 (>= cur end)) ; We moved to the next block.
1646 (if end ; i.e. (>= cur end)
1647 (setq start end)))
1648 (setq idx start col 0 end start num-items 0)
1649 ;; Loop until we hit the tail, or reach the block of CUR.
1650 (while (and (< idx len) (>= cur end))
1659 (setq end idx num-items 0)
1665 (setq end idx)
1668 (setcar (nthcdr 2 indices) end)))
1670 (if (>= (+ start relative-index) end)
1671 (setcar indices (1- end))
1683 sequence. The number is the count of valid keys in the current
1714 ;; At first, get translation of "...AB".
1716 ;; Then, return the length of "...AB".
1756 "Select next translation in the current batch of candidates."
1771 "Select previous translation in the current batch of candidates."
1786 "Select from the next block of translations."
1802 "Select the previous batch of 10 translation candidates."
1829 "Delete the last input character from the current Quail key sequence."
1840 "Return non-nil value if the point is in conversion region of Quail mode."
1844 (<= pos (overlay-end quail-conv-overlay)))))
1849 (quail-error "Beginning of conversion region"))
1855 (if (>= (point) (overlay-end quail-conv-overlay))
1856 (quail-error "End of conversion region"))
1860 (defun quail-conversion-beginning-of-region ()
1865 (defun quail-conversion-end-of-region ()
1868 (goto-char (overlay-end quail-conv-overlay)))
1873 (if (>= (point) (overlay-end quail-conv-overlay))
1874 (quail-error "End of conversion region"))
1877 (end (overlay-end quail-conv-overlay)))
1878 (setq quail-conversion-str (buffer-substring start end))
1879 (if (= start end)
1884 (if (>= (point) (overlay-end quail-conv-overlay))
1885 (quail-error "End of conversion region"))
1886 (delete-region (point) (overlay-end quail-conv-overlay))
1888 (end (overlay-end quail-conv-overlay)))
1889 (setq quail-conversion-str (buffer-substring start end))
1890 (if (= start end)
1898 (quail-error "Beginning of conversion region"))
1901 (end (overlay-end quail-conv-overlay)))
1902 (setq quail-conversion-str (buffer-substring start end))
1903 (if (= start end)
1907 "Call FUNC to convert text in the current conversion region of Quail.
1913 "Do no conversion of the current conversion region of Quail."
1946 (and input-method-verbose-flag
1947 (if (eq input-method-verbose-flag 'default)
1950 (if (eq input-method-verbose-flag 'complex-only)
1955 ;; Quail specific version of minibuffer-message. It displays STRING
1956 ;; with timeout 1000000 seconds instead of two seconds.
1972 "Display a guidance for Quail input method in some window.
1982 (not input-method-use-echo-area)
1984 (null unread-post-input-method-events))
2004 (format " [%s]" current-input-method-title)))
2005 ;; Show the guidance in the next line of the currrent
2009 current-input-method-title quail-guidance-str)))
2018 input-method-use-echo-area)
2037 ;; Show the current input keys.
2064 ;; Now POS points end of KEY and (point) points end of STR.
2071 (beginning-of-line)
2101 ;; Show list of translations.
2107 (end (nth 2 indices))
2122 (while (< idx end)
2140 "The maximum depth of Quail completion list.")
2144 All possible translations of the current key and whole possible longer keys
2179 "List all completions of KEY in MAP with indentation INDENT."
2195 ;; Set KEY in the first LEN characters of NEWKEY.
2206 "List all possible translations of KEY in Quail MAP with indentation INDENT."
2230 ;; We show the last digit of FROM while converting
2243 ;; This function is an exact copy of the mouse.el function
2260 (let (beg end)
2262 (setq end (point) beg (1+ (point))))
2264 (setq end (1- (point)) beg (point)))
2268 (setq end (or (next-single-property-change end 'mouse-face)
2270 (setq choice (buffer-substring beg end)))))
2284 ;; BASE-SIZE here is for compatibility with an (unused) arg of a
2293 Accumulate in the cdr part of DECODE-MAP all pairs of key sequences
2297 \(decode-map . ALIST), where ALIST is an alist of length NUM. KEY
2299 Optional 5th arg MAXNUM limits the number of accumulated pairs.
2300 Optional 6th arg IGNORES is a list of translations to ignore."
2339 "Insert pairs of key sequences vs the corresponding translations.
2357 ;; Divide the elements of decoding map into single ones (i.e. the
2446 "Show brief description of the current Quail package.
2447 Optional arg PACKAGE specifies the name of alternative Quail
2462 ;; the width of the window in which the buffer displayed.
2492 This input method works by translating individual input characters.
2508 (insert "', the \"virtual\" keyboard you get with this input method
2512 the physical layout of your keyboard; the tables shown in
2513 documentation of input methods including this one are based on the
2532 (insert "You can also input more characters")
2533 (insert "You can input characters"))
2574 (1+ (line-end-position)))))))
2578 (delete-region (point) (1+ (line-end-position)))
2586 "Show help message while translating in Quail input method."
2592 (format "Converting string %S by input method %S.\n"
2596 (format "Translating key sequence %S by input method %S.\n"
2611 (if (< (window-end) (point-max))
2616 (if (< (window-end (selected-window) 'up-to-date) (point-max))
2619 "Type \\[quail-translation-help] to see the head of help"))))
2629 ;; Add KEY (string) to the element of TABLE (char-table) for CHAR if
2631 ;; list of strings.
2642 (if (and translation-table-for-input
2643 (setq char (aref translation-table-for-input char)))
2644 (let ((translation-table-for-input nil))
2649 ;; element of the current Quail map reached by typing keys in KEY
2680 ;; of a key strings to type to input C. The lenth of key string is at
2681 ;; most 2. If it is 2, more keys may be required to input C.
2690 ;; by translation-table-for-input.
2694 (and translation-table-for-input
2695 (setq char (aref translation-table-for-input char))
2699 ;; for inputting CHAR by the current input method to KEY-LIST and
2700 ;; return the result. MAP is an element of the current Quail map
2735 ;; where QUAIL-MAP is a quail-map of which decode map was generated
2741 "Return a list of keys to type to input CHAR in the current input method.
2742 If CHAR is an ASCII character and can be input by typing itself, return t."
2775 "Show a list of key strings to type for inputting a character at point."
2777 (or current-input-method
2778 (error "No input method is activated"))
2779 (or (assoc current-input-method quail-package-alist)
2780 (error "The current input method does not use Quail"))
2784 (message "To input `%c', type \"%s\""
2788 (message "To input `%s', just type it"
2791 (message "%c can't be input by the current input method" char)))))
2806 \(RULES . STATE-x) or RULES, where STATE-x is one of STATE-n above,
2807 RULES is a symbol whose value is an alist of keys \(string) vs the
2808 correponding characters or strings. The format of the symbol value of
2812 STATE-n transits to STATE-x when keys in RULES are input. Recursive
2816 when keys in RULES are input.
2822 ;; STATE-ALIST is an alist of states vs the correponding sub Quail
2824 ;; Set key sequence mapping rules in cdr part of each element.
2830 ;; Elements of MAPPING-RULES may have the form (STATE-x). Replace
2831 ;; them with MAPPING-RULES of STATE-x to make elements of
2842 ;; mapping rules in the element of STATE-ALIST that corresponds to
2853 ;; STATE-x is one of car parts of STATE-ALIST's elements.
2870 ;; ELEMENT is one element of STATE-ALIST. ELEMENT is a nested alist;
2877 ;; Here, the task is to replace all occurrences of (STATE-x) with:
2892 ;; Concatenate translations for all heading substrings of KEY in the
2914 "Name of Quail directory which contains Quail packages.
2915 This is a sub-directory of LEIM directory.")
2920 DIRNAME is a directory containing Emacs input methods;
2922 of the Emacs source tree.
2924 It searches for Quail packages under `quail' subdirectory of DIRNAME,
2929 of each directory."
2930 (interactive "FDirectory of LEIM: ")
2945 (goto-char (match-end 0))
2985 ;; Insert input method registering forms.
3002 (format "(register-input-method
3017 ;; Ignore the remaining contents of this file.
3019 (message "Some part of \"%s\" is broken" (car pkg-list))))))
3032 "Advise users about the characters input by the current Quail package.
3033 The argument is a parameterized event of the form:
3035 where STRING is a string containing the input characters.