annotate lisp/mule/mule-cmds.el @ 444:576fb035e263 r21-2-37

Import from CVS: tag r21-2-37
author cvs
date Mon, 13 Aug 2007 11:36:19 +0200
parents abe6d1db359e
children 3078fd1074e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;;; mule-cmds.el --- Commands for multilingual environment
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Copyright (C) 1995,1999 Electrotechnical Laboratory, JAPAN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 ;; Licensed to the Free Software Foundation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 ;; Copyright (C) 1997 MORIOKA Tomohiko
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 ;; Keywords: mule, multilingual
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ;; under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ;; any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 ;; General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 ;; 02111-1307, USA.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
26 ;; Note: Some of the code here is now in code-cmds.el
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
27
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 ;;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 ;;; MULE related key bindings and menus.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
32 (require 'code-cmds)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
34 ;; Preserve the old name
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
35 (defvaralias 'mule-keymap 'coding-keymap)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
36
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 (define-key mule-keymap "x" 'set-selection-coding-system)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 (define-key mule-keymap "X" 'set-next-selection-coding-system)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 (define-key mule-keymap "\C-\\" 'set-input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 ;;(define-key mule-keymap "c" 'list-coding-system-briefly) ; XEmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 (define-key mule-keymap "C" 'describe-coding-system) ; XEmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 (define-key mule-keymap "r" 'toggle-display-direction) ; XEmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 (define-key mule-keymap "l" 'set-language-environment)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 (define-key help-map "L" 'describe-language-environment)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 (define-key help-map "\C-\\" 'describe-input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 (define-key help-map "I" 'describe-input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 (define-key help-map "h" 'view-hello-file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 ;; Menu for XEmacs were moved to menubar-items.el.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 ;; This should be a single character key binding because users use it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 ;; very frequently while editing multilingual text. Now we can use
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 ;; only two such keys: "\C-\\" and "\C-^", but the latter is not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 ;; convenient because it requires shifting on most keyboards. An
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 ;; alternative is "\C-\]" which is now bound to `abort-recursive-edit'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 ;; but it won't be used that frequently.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 (define-key global-map "\C-\\" 'toggle-input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 ;;; This is no good because people often type Shift-SPC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 ;;; meaning to type SPC. -- rms.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 ;;; ;; Here's an alternative key binding for X users (Shift-SPACE).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 ;;; (define-key global-map [?\S- ] 'toggle-input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 (defun coding-system-change-eol-conversion (coding-system eol-type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 "Return a coding system which differs from CODING-SYSTEM in eol conversion.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 The returned coding system converts end-of-line by EOL-TYPE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 but text as the same way as CODING-SYSTEM.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 EOL-TYPE should be `lf', `crlf', `cr' or nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 If EOL-TYPE is nil, the returned coding system detects
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 how end-of-line is formatted automatically while decoding.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 EOL-TYPE can be specified by an symbol `unix', `dos' or `mac'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 They means `lf', `crlf', and `cr' respectively."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 (if (symbolp eol-type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 (setq eol-type (cond ((or (eq eol-type 'unix)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 (eq eol-type 'lf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 'eol-lf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 ((or (eq eol-type 'dos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 (eq eol-type 'crlf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 'eol-crlf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 ((or (eq eol-type 'mac)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 (eq eol-type 'cr))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 'eol-cr)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 (t eol-type))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 (let ((orig-eol-type (coding-system-eol-type coding-system)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 (if (null orig-eol-type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 (if (not eol-type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 coding-system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 (coding-system-property coding-system eol-type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 (let ((base (coding-system-base coding-system)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 (if (not eol-type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 base
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
95 (if (eq eol-type orig-eol-type)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 coding-system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 (setq orig-eol-type (coding-system-eol-type base))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 (if (null orig-eol-type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 (coding-system-property base eol-type))))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 ;; (defun coding-system-change-text-conversion (coding-system coding)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 ;; "Return a coding system which differs from CODING-SYSTEM in text conversion.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 ;; The returned coding system converts text by CODING
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 ;; but end-of-line as the same way as CODING-SYSTEM.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 ;; If CODING is nil, the returned coding system detects
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 ;; how text is formatted automatically while decoding."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 ;; (if (not coding)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 ;; (coding-system-base coding-system)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 ;; (let ((eol-type (coding-system-eol-type coding-system)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 ;; (coding-system-change-eol-conversion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 ;; coding
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 ;; (if (numberp eol-type) (aref [unix dos mac] eol-type))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 (defun view-hello-file ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 "Display the HELLO file which list up many languages and characters."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 ;; We have to decode the file in any environment.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 (let ((coding-system-for-read 'iso-2022-7bit))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 (find-file-read-only (expand-file-name "HELLO" data-directory))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 ;;; Language support stuff.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 (defvar language-info-alist nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 "Alist of language environment definitions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 Each element looks like:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 (LANGUAGE-NAME . ((KEY . INFO) ...))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 where LANGUAGE-NAME is a string, the name of the language environment,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 KEY is a symbol denoting the kind of information, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 INFO is the data associated with KEY.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 Meaningful values for KEY include
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 documentation value is documentation of what this language environment
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 is meant for, and how to use it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 charset value is a list of the character sets used by this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 language environment.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 sample-text value is one line of text,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 written using those character sets,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 appropriate for this language environment.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 setup-function value is a function to call to switch to this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 language environment.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 exit-function value is a function to call to leave this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 language environment.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 coding-system value is a list of coding systems that are good
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 for saving text written in this language environment.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 This list serves as suggestions to the user;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 in effect, as a kind of documentation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 coding-priority value is a list of coding systems for this language
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 environment, in order of decreasing priority.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 This is used to set up the coding system priority
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 list when you switch to this language environment.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 input-method value is a default input method for this language
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 environment.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 features value is a list of features requested in this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 language environment.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 tutorial value is a tutorial file name written in the language.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 (defun get-language-info (lang-env key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 "Return information listed under KEY for language environment LANG-ENV.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 KEY is a symbol denoting the kind of information.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 For a list of useful values for KEY and their meanings,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 see `language-info-alist'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 (if (symbolp lang-env)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 (setq lang-env (symbol-name lang-env)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 (let ((lang-slot (assoc-ignore-case lang-env language-info-alist)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 (if lang-slot
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 (cdr (assq key (cdr lang-slot))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 (defun set-language-info (lang-env key info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 "Modify part of the definition of language environment LANG-ENV.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 Specifically, this stores the information INFO under KEY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 in the definition of this language environment.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 KEY is a symbol denoting the kind of information.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 INFO is the value for that information.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 For a list of useful values for KEY and their meanings,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 see `language-info-alist'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 (if (symbolp lang-env)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 (setq lang-env (symbol-name lang-env)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 (let (lang-slot key-slot)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 (setq lang-slot (assoc lang-env language-info-alist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 (if (null lang-slot) ; If no slot for the language, add it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 (setq lang-slot (list lang-env)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 language-info-alist (cons lang-slot language-info-alist)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 (setq key-slot (assq key lang-slot))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 (if (null key-slot) ; If no slot for the key, add it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 (setq key-slot (list key))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 (setcdr lang-slot (cons key-slot (cdr lang-slot)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 (setcdr key-slot info)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 (defun set-language-info-alist (lang-env alist &optional parents)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 "Store ALIST as the definition of language environment LANG-ENV.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 ALIST is an alist of KEY and INFO values. See the documentation of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 `set-language-info' for the meanings of KEY and INFO."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 (if (symbolp lang-env)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 (setq lang-env (symbol-name lang-env)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 (let (; (describe-map describe-language-environment-map)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 ; (setup-map setup-language-environment-map)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 ;; (if parents
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 ;; (let ((l parents)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 ;; map parent-symbol parent)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 ;; (while l
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 ;; (if (symbolp (setq parent-symbol (car l)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 ;; (setq parent (symbol-name parent))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 ;; (setq parent parent-symbol parent-symbol (intern parent)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 ;; (setq map (lookup-key describe-map (vector parent-symbol)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 ;; (if (not map)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 ;; (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 ;; (setq map (intern (format "describe-%s-environment-map"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 ;; (downcase parent))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 ;; (define-prefix-command map)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 ;; (define-key-after describe-map (vector parent-symbol)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 ;; (cons parent map) t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 ;; (setq describe-map (symbol-value map))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 ;; (setq map (lookup-key setup-map (vector parent-symbol)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 ;; (if (not map)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 ;; (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 ;; (setq map (intern (format "setup-%s-environment-map"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 ;; (downcase parent))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 ;; (define-prefix-command map)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 ;; (define-key-after setup-map (vector parent-symbol)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 ;; (cons parent map) t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 ;; (setq setup-map (symbol-value map))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 ;; (setq l (cdr l)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 ;; Set up menu items for this language env.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 (let ((doc (assq 'documentation alist)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 (when doc
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 ;; (define-key-after describe-map (vector (intern lang-env))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 ;; (cons lang-env 'describe-specified-language-support) t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 (when (featurep 'menubar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 (eval-after-load
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 "menubar-items.elc"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 `(add-menu-button
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
237 '("%_Edit" "%_Multilingual (\"Mule\")"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
238 "%_Describe Language Support")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 (vector ,lang-env
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 '(describe-language-environment ,lang-env)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 t))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 ;; (define-key-after setup-map (vector (intern lang-env))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 ;; (cons lang-env 'setup-specified-language-environment) t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 (when (featurep 'menubar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 (eval-after-load
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 "menubar-items.elc"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 `(add-menu-button
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
249 '("%_Edit" "%_Multilingual (\"Mule\")"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
250 "%_Set Language Environment")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 (vector ,lang-env
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 '(set-language-environment ,lang-env)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 t))))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
254
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 (while alist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 (set-language-info lang-env (car (car alist)) (cdr (car alist)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 (setq alist (cdr alist)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 (defun read-language-name (key prompt &optional default)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 "Read a language environment name which has information for KEY.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 If KEY is nil, read any language environment.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 Prompt with PROMPT. DEFAULT is the default choice of language environment.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 This returns a language environment name as a string."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 (let* ((completion-ignore-case t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 (name (completing-read prompt
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 language-info-alist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 (and key
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 (function (lambda (elm) (assq key elm))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 t nil nil default)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 (if (and (> (length name) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 (or (not key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 (get-language-info name key)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 name)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 ;;; Multilingual input methods.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 (defconst leim-list-file-name "leim-list.el"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 "Name of LEIM list file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 This file contains a list of libraries of Emacs input methods (LEIM)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 in the format of Lisp expression for registering each input method.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 Emacs loads this file at startup time.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 (defvar leim-list-header (format
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 ";;; %s -- list of LEIM (Library of Emacs Input Method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 ;; This file contains a list of LEIM (Library of Emacs Input Method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 ;; in the same directory as this file. Loading this file registers
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 ;; the whole input methods in Emacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 ;; Each entry has the form:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 ;; (register-input-method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 ;; INPUT-METHOD LANGUAGE-NAME ACTIVATE-FUNC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 ;; TITLE DESCRIPTION
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 ;; ARG ...)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 ;; See the function `register-input-method' for the meanings of arguments.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 ;; If this directory is included in load-path, Emacs automatically
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 ;; loads this file at startup time.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 leim-list-file-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 "Header to be inserted in LEIM list file.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 (defvar leim-list-entry-regexp "^(register-input-method"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 "Regexp matching head of each entry in LEIM list file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 See also the variable `leim-list-header'")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 (defvar update-leim-list-functions
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 '(quail-update-leim-list-file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 "List of functions to call to update LEIM list file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 Each function is called with one arg, LEIM directory name.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 (defun update-leim-list-file (&rest dirs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 "Update LEIM list file in directories DIRS."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 (let ((functions update-leim-list-functions))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 (while functions
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 (apply (car functions) dirs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 (setq functions (cdr functions)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 (defvar current-input-method nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 "The current input method for multilingual text.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 If nil, that means no input method is activated now.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 (make-variable-buffer-local 'current-input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 (put 'current-input-method 'permanent-local t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 (defvar current-input-method-title nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 "Title string of the current input method shown in mode line.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 (make-variable-buffer-local 'current-input-method-title)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 (put 'current-input-method-title 'permanent-local t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 (defcustom default-input-method nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 "*Default input method for multilingual text (a string).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 This is the input method activated automatically by the command
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 `toggle-input-method' (\\[toggle-input-method])."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 :group 'mule
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 :type '(choice (const nil) string))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 (put 'input-method-function 'permanent-local t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 (defvar input-method-history nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 "History list for some commands that read input methods.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 (make-variable-buffer-local 'input-method-history)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 (put 'input-method-history 'permanent-local t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 (defvar inactivate-current-input-method-function nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 "Function to call for inactivating the current input method.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 Every input method should set this to an appropriate value when activated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 This function is called with no argument.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 This function should never change the value of `current-input-method'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 It is set to nil by the function `inactivate-input-method'.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 (make-variable-buffer-local 'inactivate-current-input-method-function)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 (put 'inactivate-current-input-method-function 'permanent-local t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 (defvar describe-current-input-method-function nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 "Function to call for describing the current input method.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 This function is called with no argument.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 (make-variable-buffer-local 'describe-current-input-method-function)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 (put 'describe-current-input-method-function 'permanent-local t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 (defvar input-method-alist nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 "Alist of input method names vs how to use them.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 Each element has the form:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 (INPUT-METHOD LANGUAGE-ENV ACTIVATE-FUNC TITLE DESCRIPTION ARGS...)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 See the function `register-input-method' for the meanings of the elements.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 (defun register-input-method (input-method lang-env &rest args)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 "Register INPUT-METHOD as an input method for language environment ENV.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 INPUT-METHOD and LANG-ENV are symbols or strings.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 The remaining arguments are:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 ACTIVATE-FUNC, TITLE, DESCRIPTION, and ARGS...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 ACTIVATE-FUNC is a function to call to activate this method.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 TITLE is a string to show in the mode line when this method is active.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 DESCRIPTION is a string describing this method and what it is good for.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 The ARGS, if any, are passed as arguments to ACTIVATE-FUNC.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 All told, the arguments to ACTIVATE-FUNC are INPUT-METHOD and the ARGS.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 This function is mainly used in the file \"leim-list.el\" which is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 created at building time of emacs, registering all quail input methods
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 contained in the emacs distribution.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 In case you want to register a new quail input method by yourself, be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 careful to use the same input method title as given in the third
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 parameter of `quail-define-package' (if the values are different, the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 string specified in this function takes precedence).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 The commands `describe-input-method' and `list-input-methods' need
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 this duplicated values to show some information about input methods
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 without loading the affected quail packages."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 (if (symbolp lang-env)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 (setq lang-env (symbol-name lang-env)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 (if (symbolp input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 (setq input-method (symbol-name input-method)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 (let ((info (cons lang-env args))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 (slot (assoc input-method input-method-alist)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 (if slot
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 (setcdr slot info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 (setq slot (cons input-method info))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 (setq input-method-alist (cons slot input-method-alist)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 (defun read-input-method-name (prompt &optional default inhibit-null)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 "Read a name of input method from a minibuffer prompting with PROMPT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 If DEFAULT is non-nil, use that as the default,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 and substitute it into PROMPT at the first `%s'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 If INHIBIT-NULL is non-nil, null input signals an error.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 The return value is a string."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 (if default
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 (setq prompt (format prompt default)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 (let* ((completion-ignore-case t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 ;; This binding is necessary because input-method-history is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 ;; buffer local.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 (input-method (completing-read prompt input-method-alist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 nil t nil 'input-method-history
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 default)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 (if (and input-method (symbolp input-method))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 (setq input-method (symbol-name input-method)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 (if (> (length input-method) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 input-method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 (if inhibit-null
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 (error "No valid input method is specified")))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 (defun activate-input-method (input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 "Switch to input method INPUT-METHOD for the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 If some other input method is already active, turn it off first.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 If INPUT-METHOD is nil, deactivate any current input method."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 (if (and input-method (symbolp input-method))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 (setq input-method (symbol-name input-method)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 (if (and current-input-method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 (not (string= current-input-method input-method)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 (inactivate-input-method))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 (unless (or current-input-method (null input-method))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 (let ((slot (assoc input-method input-method-alist)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 (if (null slot)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 (error "Can't activate input method `%s'" input-method))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 (let ((func (nth 2 slot)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 (if (functionp func)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 (apply (nth 2 slot) input-method (nthcdr 5 slot))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 (if (and (consp func) (symbolp (car func)) (symbolp (cdr func)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 (require (cdr func))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 (apply (car func) input-method (nthcdr 5 slot)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 (error "Can't activate input method `%s'" input-method))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 (setq current-input-method input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 (setq current-input-method-title (nth 3 slot))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 (unwind-protect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 (run-hooks 'input-method-activate-hook)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 (force-mode-line-update)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 (defun inactivate-input-method ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 "Turn off the current input method."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 (when current-input-method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 (if input-method-history
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 (unless (string= current-input-method (car input-method-history))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 (setq input-method-history
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 (cons current-input-method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 (delete current-input-method input-method-history))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 (setq input-method-history (list current-input-method)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 (unwind-protect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 (funcall inactivate-current-input-method-function)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 (unwind-protect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 (run-hooks 'input-method-inactivate-hook)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 (setq current-input-method nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 current-input-method-title nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 (force-mode-line-update)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 (defun set-input-method (input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 "Select and activate input method INPUT-METHOD for the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 This also sets the default input method to the one you specify."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 (interactive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 (let* ((default (or (car input-method-history) default-input-method)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 (list (read-input-method-name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 (if default "Select input method (default %s): " "Select input method: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 default t))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 (activate-input-method input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 (setq default-input-method input-method))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 (defun toggle-input-method (&optional arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 "Turn on or off a multilingual text input method for the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 With no prefix argument, if an input method is currently activated,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 turn it off. Otherwise, activate an input method -- the one most
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 recently used, or the one specified in `default-input-method', or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 the one read from the minibuffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 With a prefix argument, read an input method from the minibuffer and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 turn it on.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 The default is to use the most recent input method specified
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 \(not including the currently active input method, if any)."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 (interactive "P")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 (if (and current-input-method (not arg))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 (inactivate-input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 (let ((default (or (car input-method-history) default-input-method)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 (if (and arg default (equal current-input-method default)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 (> (length input-method-history) 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 (setq default (nth 1 input-method-history)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 (activate-input-method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 (if (or arg (not default))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 (read-input-method-name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 (if default "Input method (default %s): " "Input method: " )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 default t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 default))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 (or default-input-method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 (setq default-input-method current-input-method)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 (defun describe-input-method (input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 "Describe input method INPUT-METHOD."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 (interactive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 (list (read-input-method-name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 "Describe input method (default, current choice): ")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 (if (and input-method (symbolp input-method))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 (setq input-method (symbol-name input-method)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 (if (null input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 (describe-current-input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 (with-output-to-temp-buffer "*Help*"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 (let ((elt (assoc input-method input-method-alist)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 (princ (format "Input method: %s (`%s' in mode line) for %s\n %s\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 input-method (nth 3 elt) (nth 1 elt) (nth 4 elt)))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 (defun describe-current-input-method ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 "Describe the input method currently in use."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 (if current-input-method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 (if (and (symbolp describe-current-input-method-function)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 (fboundp describe-current-input-method-function))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 (funcall describe-current-input-method-function)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 (message "No way to describe the current input method `%s'"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 current-input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 (ding))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 (error "No input method is activated now")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 (defun read-multilingual-string (prompt &optional initial-input input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 "Read a multilingual string from minibuffer, prompting with string PROMPT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 The input method selected last time is activated in minibuffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 If optional second arg INITIAL-INPUT is non-nil, insert it in the minibuffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 initially.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 Optional 3rd argument INPUT-METHOD specifies the input method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 to be activated instead of the one selected last time. It is a symbol
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 or a string."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 (setq input-method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 (or input-method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 current-input-method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 default-input-method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 (read-input-method-name "Input method: " nil t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 (if (and input-method (symbolp input-method))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 (setq input-method (symbol-name input-method)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 (let ((prev-input-method current-input-method))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 (unwind-protect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 (activate-input-method input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 ;; FSF Emacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 ;; (read-string prompt initial-input nil nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 (read-string prompt initial-input nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 (activate-input-method prev-input-method))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 ;; Variables to control behavior of input methods. All input methods
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 ;; should react to these variables.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 (defcustom input-method-verbose-flag 'default
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 "*A flag to control extra guidance given by input methods.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 The value should be nil, t, `complex-only', or `default'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 The extra guidance is done by showing list of available keys in echo
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 area. When you use the input method in the minibuffer, the guidance
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 is shown at the bottom short window (split from the existing window).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 If the value is t, extra guidance is always given, if the value is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 nil, extra guidance is always suppressed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 If the value is `complex-only', only complex input methods such as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 `chinese-py' and `japanese' give extra guidance.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 If the value is `default', complex input methods always give extra
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 guidance, but simple input methods give it only when you are not in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 the minibuffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 See also the variable `input-method-highlight-flag'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 :type '(choice (const t) (const nil) (const complex-only) (const default))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 :group 'mule)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 (defcustom input-method-highlight-flag t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 "*If this flag is non-nil, input methods highlight partially-entered text.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 For instance, while you are in the middle of a Quail input method sequence,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 the text inserted so far is temporarily underlined.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 The underlining goes away when you finish or abort the input method sequence.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 See also the variable `input-method-verbose-flag'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 :group 'mule)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 (defvar input-method-activate-hook nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 "Normal hook run just after an input method is activated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 The variable `current-input-method' keeps the input method name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 just activated.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 (defvar input-method-inactivate-hook nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 "Normal hook run just after an input method is inactivated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 The variable `current-input-method' still keeps the input method name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 just inactivated.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 (defvar input-method-after-insert-chunk-hook nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 "Normal hook run just after an input method insert some chunk of text.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 (defvar input-method-exit-on-first-char nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 "This flag controls a timing when an input method returns.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 Usually, the input method does not return while there's a possibility
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 that it may find a different translation if a user types another key.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 But, it this flag is non-nil, the input method returns as soon as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 the current key sequence gets long enough to have some valid translation.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 (defvar input-method-use-echo-area nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 "This flag controls how an input method shows an intermediate key sequence.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 Usually, the input method inserts the intermediate key sequence,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 or candidate translations corresponding to the sequence,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 at point in the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 But, if this flag is non-nil, it displays them in echo area instead.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 (defvar input-method-exit-on-invalid-key nil
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
622 "This flag controls the behavior of an input method on invalid key input.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 Usually, when a user types a key which doesn't start any character
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 handled by the input method, the key is handled by turning off the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 input method temporarily. After that key, the input method is re-enabled.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 But, if this flag is non-nil, the input method is never back on.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 (defvar set-language-environment-hook nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630 "Normal hook run after some language environment is set.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 When you set some hook function here, that effect usually should not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 be inherited to another language environment. So, you had better set
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 another function in `exit-language-environment-hook' (which see) to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635 cancel the effect.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637 (defvar exit-language-environment-hook nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638 "Normal hook run after exiting from some language environment.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
639 When this hook is run, the variable `current-language-environment'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640 is still bound to the language environment being exited.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642 This hook is mainly used for canceling the effect of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 `set-language-environment-hook' (which-see).")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 (put 'setup-specified-language-environment 'apropos-inhibit t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 (defun setup-specified-language-environment ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 "Switch to a specified language environment."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 (let (language-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 (if (and (symbolp last-command-event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 (or (not (eq last-command-event 'Default))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 (setq last-command-event 'English))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 (setq language-name (symbol-name last-command-event)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655 (set-language-environment language-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
656 (error "Bogus calling sequence"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658 (defcustom current-language-environment "English"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 "The last language environment specified with `set-language-environment'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660 This variable should be set only with \\[customize], which is equivalent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661 to using the function `set-language-environment'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 :link '(custom-manual "(emacs)Language Environments")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 :set (lambda (symbol value) (set-language-environment value))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 :get (lambda (x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 (or (car-safe (assoc-ignore-case
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 (if (symbolp current-language-environment)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 (symbol-name current-language-environment)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668 current-language-environment)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669 language-info-alist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670 "English"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 :type (cons 'choice (mapcar (lambda (lang)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672 (list 'const (car lang)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 language-info-alist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674 :initialize 'custom-initialize-default
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 :group 'mule
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676 :type 'string)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 (defun reset-language-environment ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 "Reset multilingual environment of Emacs to the default status.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 The default status is as follows:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
683 The default value of `buffer-file-coding-system' is nil.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 The default coding system for process I/O is nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
685 The default value for the command `set-terminal-coding-system' is nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686 The default value for the command `set-keyboard-coding-system' is nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
688 The order of priorities of coding categories and the coding system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
689 bound to each category are as follows
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
690 coding category coding system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
691 --------------------------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
692 iso-8-2 iso-8859-1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693 iso-8-1 iso-8859-1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
694 iso-7 iso-2022-7bit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
695 iso-lock-shift iso-2022-lock
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696 iso-8-designate iso-2022-8bit-ss2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 no-conversion raw-text
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698 shift-jis shift_jis
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699 big5 big5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
700 ucs-4 ----
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
701 utf-8 ----
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
702 "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 ;; This function formerly set default-enable-multibyte-characters to t,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705 ;; but that is incorrect. It should not alter the unibyte/multibyte choice.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707 (set-coding-category-system 'iso-7 'iso-2022-7bit)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
708 (set-coding-category-system 'iso-8-1 'iso-8859-1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
709 (set-coding-category-system 'iso-8-2 'iso-8859-1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
710 (set-coding-category-system 'iso-lock-shift 'iso-2022-lock)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711 (set-coding-category-system 'iso-8-designate 'iso-2022-8bit-ss2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712 (set-coding-category-system 'no-conversion 'raw-text)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
713 (set-coding-category-system 'shift-jis 'shift_jis)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
714 (set-coding-category-system 'big5 'big5)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
715 (cond ((eq (coding-system-type (coding-category-system 'utf-8)) 'utf-8)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
716 (set-coding-category-system 'ucs-4 'iso-10646-ucs-4)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
717 (set-coding-category-system 'utf-8 'utf-8)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
718 (set-coding-priority-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719 '(iso-8-1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
720 iso-8-2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721 iso-7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
722 iso-lock-shift
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723 iso-8-designate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
724 utf-8
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
725 ucs-4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
726 no-conversion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
727 shift-jis
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728 big5))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731 (set-coding-priority-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
732 '(iso-8-1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 iso-8-2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734 iso-7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
735 iso-lock-shift
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736 iso-8-designate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 no-conversion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738 shift-jis
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739 big5))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742 ;; (update-coding-systems-internal)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744 (set-default-coding-systems nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 ;; Don't alter the terminal and keyboard coding systems here.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 ;; The terminal still supports the same coding system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747 ;; that it supported a minute ago.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748 ;;; (set-terminal-coding-system-internal nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749 ;;; (set-keyboard-coding-system-internal nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751 ;; (setq nonascii-translation-table nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
752 ;; nonascii-insert-offset 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
753 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755 (defun set-language-environment (language-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756 "Set up multi-lingual environment for using LANGUAGE-NAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
757 This sets the coding system priority and the default input method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
758 and sometimes other things. LANGUAGE-NAME should be a string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
759 which is the name of a language environment. For example, \"Latin-1\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
760 specifies the character set for the major languages of Western Europe."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
761 (interactive (list (read-language-name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
762 nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763 "Set language environment (default, English): ")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 (if language-name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765 (if (symbolp language-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
766 (setq language-name (symbol-name language-name)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767 (setq language-name "English"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
768 (or (assoc-ignore-case language-name language-info-alist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
769 (error "Language environment not defined: %S" language-name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
770 (if current-language-environment
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
771 (let ((func (get-language-info current-language-environment
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
772 'exit-function)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
773 (run-hooks 'exit-language-environment-hook)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
774 (if (fboundp func) (funcall func))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
775 (let ((default-eol-type (coding-system-eol-type
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
776 default-buffer-file-coding-system)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
777 (reset-language-environment)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779 (setq current-language-environment language-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780 (set-language-environment-coding-systems language-name default-eol-type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781 (let ((input-method (get-language-info language-name 'input-method)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782 (when input-method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
783 (setq default-input-method input-method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784 (if input-method-history
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
785 (setq input-method-history
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
786 (cons input-method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
787 (delete input-method input-method-history))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
788 ;; (let ((nonascii (get-language-info language-name 'nonascii-translation))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
789 ;; (dos-table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
790 ;; (if (eq window-system 'pc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791 ;; (intern
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792 ;; (concat "cp" dos-codepage "-nonascii-translation-table")))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793 ;; (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 ;; ((char-table-p nonascii)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795 ;; (setq nonascii-translation-table nonascii))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796 ;; ((and (eq window-system 'pc) (boundp dos-table))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797 ;; ;; DOS terminals' default is to use a special non-ASCII translation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
798 ;; ;; table as appropriate for the installed codepage.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
799 ;; (setq nonascii-translation-table (symbol-value dos-table)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800 ;; ((charsetp nonascii)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801 ;; (setq nonascii-insert-offset (- (make-char nonascii) 128)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 ;; (setq charset-origin-alist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
804 ;; (get-language-info language-name 'charset-origin-alist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
805
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
806 ;; Unibyte setups if necessary.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
807 ;; (unless default-enable-multibyte-characters
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
808 ;; ;; Syntax and case table.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809 ;; (let ((syntax (get-language-info language-name 'unibyte-syntax)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810 ;; (if syntax
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811 ;; (let ((set-case-syntax-set-multibyte nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
812 ;; (load syntax nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 ;; ;; No information for syntax and case. Reset to the defaults.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814 ;; (let ((syntax-table (standard-syntax-table))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 ;; (case-table (standard-case-table))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816 ;; (ch (if (eq window-system 'pc) 128 160)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
817 ;; (while (< ch 256)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
818 ;; (modify-syntax-entry ch " " syntax-table)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819 ;; (aset case-table ch ch)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
820 ;; (setq ch (1+ ch)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
821 ;; (set-char-table-extra-slot case-table 0 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822 ;; (set-char-table-extra-slot case-table 1 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823 ;; (set-char-table-extra-slot case-table 2 nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
824 ;; (set-standard-case-table (standard-case-table))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
825 ;; (let ((list (buffer-list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
826 ;; (while list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
827 ;; (with-current-buffer (car list)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
828 ;; (set-case-table (standard-case-table)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
829 ;; (setq list (cdr list))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
830 ;; ;; Display table and coding system for terminal.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
831 ;; (let ((coding (get-language-info language-name 'unibyte-display)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
832 ;; (if coding
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
833 ;; (standard-display-european-internal)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
834 ;; (standard-display-default (if (eq window-system 'pc) 128 160) 255)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
835 ;; (aset standard-display-table 146 nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836 ;; (or (eq window-system 'pc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
837 ;; (set-terminal-coding-system coding))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
838
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 (let ((required-features (get-language-info language-name 'features)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840 (while required-features
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
841 (require (car required-features))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842 (setq required-features (cdr required-features))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843 (let ((func (get-language-info language-name 'setup-function)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 (if (fboundp func)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845 (funcall func)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
846 (run-hooks 'set-language-environment-hook)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 (force-mode-line-update t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 ;; (defun standard-display-european-internal ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850 ;; ;; Actually set up direct output of non-ASCII characters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851 ;; (standard-display-8bit (if (eq window-system 'pc) 128 160) 255)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852 ;; ;; Unibyte Emacs on MS-DOS wants to display all 8-bit characters with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
853 ;; ;; the native font, and codes 160 and 146 stand for something very
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 ;; ;; different there.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855 ;; (or (and (eq window-system 'pc) (not default-enable-multibyte-characters))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856 ;; (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857 ;; ;; Make non-line-break space display as a plain space.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 ;; ;; Most X fonts do the wrong thing for code 160.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859 ;; (aset standard-display-table 160 [32])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
860 ;; ;; Most Windows programs send out apostrophe's as \222. Most X fonts
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
861 ;; ;; don't contain a character at that position. Map it to the ASCII
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
862 ;; ;; apostrophe.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
863 ;; (aset standard-display-table 146 [39]))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865 (defun set-language-environment-coding-systems (language-name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866 &optional eol-type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
867 "Do various coding system setups for language environment LANGUAGE-NAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
869 The optional arg EOL-TYPE specifies the eol-type of the default value
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870 of buffer-file-coding-system set by this function."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
871 (let* ((priority (get-language-info language-name 'coding-priority))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872 (default-coding (car priority)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873 (if priority
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 (let ((categories (mapcar 'coding-system-category priority))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
875 category checked-categories)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
876 (set-default-coding-systems
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877 (if (memq eol-type '(lf crlf cr unix dos mac))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878 (coding-system-change-eol-conversion default-coding eol-type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879 default-coding))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
880 ;; (setq default-sendmail-coding-system default-coding)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
881 (while priority
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882 (unless (memq (setq category (car categories)) checked-categories)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
883 (set-coding-category-system category (car priority))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884 (setq checked-categories (cons category checked-categories)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885 (setq priority (cdr priority)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
886 categories (cdr categories)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 (set-coding-priority-list (nreverse checked-categories))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888 ;; (update-coding-systems-internal)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889 ))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
890
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
891 ;; Print all arguments with `princ', then print "\n".
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
892 (defsubst princ-list (&rest args)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
893 (while args (princ (car args)) (setq args (cdr args)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
894 (princ "\n"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
895
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
896 (put 'describe-specified-language-support 'apropos-inhibit t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
897
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
898 ;; Print a language specific information such as input methods,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899 ;; charsets, and coding systems. This function is intended to be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900 ;; called from the menu:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 ;; [menu-bar mule describe-language-environment LANGUAGE]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
902 ;; and should not run it by `M-x describe-current-input-method-function'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
903 (defun describe-specified-language-support ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
904 "Describe how Emacs supports the specified language environment."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
905 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
906 (let (language-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
907 (if (not (and (symbolp last-command-event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
908 (setq language-name (symbol-name last-command-event))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909 (error "Bogus calling sequence"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910 (describe-language-environment language-name)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
911
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 (defun describe-language-environment (language-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
913 "Describe how Emacs supports language environment LANGUAGE-NAME."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
914 (interactive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915 (list (read-language-name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916 'documentation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
917 "Describe language environment (default, current choice): ")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
918 (if (null language-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919 (setq language-name current-language-environment))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920 (if (or (null language-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
921 (null (get-language-info language-name 'documentation)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
922 (error "No documentation for the specified language"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
923 (if (symbolp language-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
924 (setq language-name (symbol-name language-name)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
925 (let ((doc (get-language-info language-name 'documentation)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
926 (with-output-to-temp-buffer "*Help*"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
927 (princ-list language-name " language environment" "\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
928 (if (stringp doc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
929 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
930 (princ-list doc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
931 (terpri)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
932 (let ((str (get-language-info language-name 'sample-text)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
933 (if (stringp str)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
934 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
935 (princ "Sample text:\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
936 (princ-list " " str)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
937 (terpri))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
938 (let ((input-method (get-language-info language-name 'input-method))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
939 (l (copy-sequence input-method-alist)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
940 (princ "Input methods")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
941 (when input-method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
942 (princ (format " (default, %s)" input-method))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
943 (setq input-method (assoc input-method input-method-alist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
944 (setq l (cons input-method (delete input-method l))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
945 (princ ":\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
946 (while l
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
947 (if (string= language-name (nth 1 (car l)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948 (princ-list " " (car (car l))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
949 (format " (`%s' in mode line)" (nth 3 (car l)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
950 (setq l (cdr l))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
951 (terpri)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
952 (princ "Character sets:\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
953 (let ((l (get-language-info language-name 'charset)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
954 (if (null l)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
955 (princ-list " nothing specific to " language-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
956 (while l
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957 (princ-list " " (car l) ": "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
958 (charset-description (car l)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
959 (setq l (cdr l)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
960 (terpri)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
961 (princ "Coding systems:\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
962 (let ((l (get-language-info language-name 'coding-system)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
963 (if (null l)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
964 (princ-list " nothing specific to " language-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
965 (while l
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
966 (princ ; (format " %s (`%c' in mode line):\n\t%s\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
967 ;; In XEmacs, `coding-system-mnemonic' returns string.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
968 (format " %s (`%s' in mode line):\n\t%s\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
969 (car l)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
970 (coding-system-mnemonic (car l))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
971 (coding-system-doc-string (car l))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
972 ;; (let ((aliases (coding-system-get (car l) 'alias-coding-systems)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
973 ;; (when aliases
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
974 ;; (princ "\t")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
975 ;; (princ (cons 'alias: (cdr aliases)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
976 ;; (terpri)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
977 (setq l (cdr l))))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
978
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
979 ;;; Charset property
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
980
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
981 ;; (defsubst get-charset-property (charset propname)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
982 ;; "Return the value of CHARSET's PROPNAME property.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983 ;; This is the last value stored with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984 ;; `(put-charset-property CHARSET PROPNAME VALUE)'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
985 ;; (plist-get (charset-plist charset) propname))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
986
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
987 ;; (defsubst put-charset-property (charset propname value)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
988 ;; "Store CHARSETS's PROPNAME property with value VALUE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
989 ;; It can be retrieved with `(get-charset-property CHARSET PROPNAME)'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
990 ;; (set-charset-plist charset
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
991 ;; (plist-put (charset-plist charset) propname value)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
992
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
993 (defvar char-code-property-table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
994 (make-char-table 'generic)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
995 "Char-table containing a property list of each character code.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
996
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
997 See also the documentation of `get-char-code-property' and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
998 `put-char-code-property'")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
999 ;; (let ((plist (aref char-code-property-table char)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1000 (defun get-char-code-property (char propname)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1001 "Return the value of CHAR's PROPNAME property in `char-code-property-table'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1002 (let ((plist (get-char-table char char-code-property-table)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1003 (if (listp plist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1004 (car (cdr (memq propname plist))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1005
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1006 (defun put-char-code-property (char propname value)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007 "Store CHAR's PROPNAME property with VALUE in `char-code-property-table'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1008 It can be retrieved with `(get-char-code-property CHAR PROPNAME)'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1009 (let ((plist (get-char-table char char-code-property-table)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010 (if plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1011 (let ((slot (memq propname plist)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1012 (if slot
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1013 (setcar (cdr slot) value)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1014 (nconc plist (list propname value))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1015 (put-char-table char (list propname value) char-code-property-table)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1016 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1017
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1018
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1019 ;; Pretty description of encoded string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1020
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1021 ;; Alist of ISO 2022 control code vs the corresponding mnemonic string.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1022 ;; (defvar iso-2022-control-alist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1023 ;; '((?\x1b . "ESC")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1024 ;; (?\x0e . "SO")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1025 ;; (?\x0f . "SI")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1026 ;; (?\x8e . "SS2")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1027 ;; (?\x8f . "SS3")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1028 ;; (?\x9b . "CSI")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1029
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1030 ;; (defun encoded-string-description (str coding-system)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1031 ;; "Return a pretty description of STR that is encoded by CODING-SYSTEM."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 ;; (setq str (string-as-unibyte str))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033 ;; (let ((char (aref str 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034 ;; desc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035 ;; (when (< char 128)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1036 ;; (setq desc (or (cdr (assq char iso-2022-control-alist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037 ;; (char-to-string char)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1038 ;; (let ((i 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1039 ;; (len (length str)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1040 ;; (while (< i len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041 ;; (setq char (aref str i))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042 ;; (if (>= char 128)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 ;; (setq desc nil i len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 ;; (setq desc (concat desc " "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045 ;; (or (cdr (assq char iso-2022-control-alist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1046 ;; (char-to-string char)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047 ;; i (1+ i))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1048 ;; (or desc
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049 ;; (mapconcat (function (lambda (x) (format "0x%02x" x))) str " "))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1051 ;; (defun encode-coding-char (char coding-system)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052 ;; "Encode CHAR by CODING-SYSTEM and return the resulting string.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053 ;; If CODING-SYSTEM can't safely encode CHAR, return nil."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 ;; (if (cmpcharp char)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055 ;; (setq char (car (decompose-composite-char char 'list))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 ;; (let ((str1 (char-to-string char))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 ;; (str2 (make-string 2 char))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 ;; (safe-charsets (and coding-system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059 ;; (coding-system-get coding-system 'safe-charsets)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 ;; enc1 enc2 i1 i2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061 ;; (when (or (eq safe-charsets t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062 ;; (memq (char-charset char) safe-charsets))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063 ;; ;; We must find the encoded string of CHAR. But, just encoding
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1064 ;; ;; CHAR will put extra control sequences (usually to designate
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1065 ;; ;; ASCII charset) at the tail if type of CODING is ISO 2022.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066 ;; ;; To exclude such tailing bytes, we at first encode one-char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067 ;; ;; string and two-char string, then check how many bytes at the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068 ;; ;; tail of both encoded strings are the same.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1069 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1070 ;; (setq enc1 (string-as-unibyte (encode-coding-string str1 coding-system))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1071 ;; i1 (length enc1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072 ;; enc2 (string-as-unibyte (encode-coding-string str2 coding-system))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1073 ;; i2 (length enc2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 ;; (while (and (> i1 0) (= (aref enc1 (1- i1)) (aref enc2 (1- i2))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1075 ;; (setq i1 (1- i1) i2 (1- i2)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077 ;; ;; Now (substring enc1 i1) and (substring enc2 i2) are the same,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078 ;; ;; and they are the extra control sequences at the tail to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1079 ;; ;; exclude.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1080 ;; (substring enc2 0 i2))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1081
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1082
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1083 ;;; mule-cmds.el ends here