diff options
| author | Kenichi Handa | 1997-05-12 06:56:23 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-05-12 06:56:23 +0000 |
| commit | 13e82c04aa0b027d51ddc5e53232d3ac98d33113 (patch) | |
| tree | c4b970244cf808846efce1d9b59d1195908ae661 | |
| parent | 8d6913995b4c84b26d66cedd3669239f7a1390d8 (diff) | |
| download | emacs-13e82c04aa0b027d51ddc5e53232d3ac98d33113.tar.gz emacs-13e82c04aa0b027d51ddc5e53232d3ac98d33113.zip | |
(build-describe-language-support-function,
build-set-language-environment-function): The functions deleted.
(set-language-info): Doc-string modified. Chage handling of
special keys describe-function and setup-function.
(read-language-name): Return nil if a language specified does not
have KEY.
(current-input-method-title): Doc-string modified.
(select-input-method): Set current-input-method to nil even if
inactivation of the current input method failed.
(set-language-environment): Doc-string modified.
(describe-language-support): Doc-string modified. Calls an
appropriate function for each langauge.
(describe-language-support-internal): New function.
| -rw-r--r-- | lisp/international/mule-cmds.el | 167 |
1 files changed, 82 insertions, 85 deletions
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 7ef72c8d06d..a57a93efea9 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el | |||
| @@ -50,7 +50,7 @@ | |||
| 50 | (define-key mule-keymap "m" 'toggle-enable-multibyte-characters) | 50 | (define-key mule-keymap "m" 'toggle-enable-multibyte-characters) |
| 51 | (define-key mule-keymap "f" 'set-buffer-file-coding-system) | 51 | (define-key mule-keymap "f" 'set-buffer-file-coding-system) |
| 52 | (define-key mule-keymap "t" 'set-terminal-coding-system) | 52 | (define-key mule-keymap "t" 'set-terminal-coding-system) |
| 53 | (define-key mule-keymap "k" 'set-keyboard-coding-system) | 53 | (define-key mule-keymap "k" 'encoded-kbd-set-coding-system) |
| 54 | (define-key mule-keymap "p" 'set-current-process-coding-system) | 54 | (define-key mule-keymap "p" 'set-current-process-coding-system) |
| 55 | (define-key mule-keymap "i" 'select-input-method) | 55 | (define-key mule-keymap "i" 'select-input-method) |
| 56 | (define-key mule-keymap "\C-\\" 'select-input-method) | 56 | (define-key mule-keymap "\C-\\" 'select-input-method) |
| @@ -68,8 +68,8 @@ | |||
| 68 | '("--")) | 68 | '("--")) |
| 69 | (define-key mule-keymap [set-process-coding-system] | 69 | (define-key mule-keymap [set-process-coding-system] |
| 70 | '("Set coding system of process" . set-current-process-coding-system)) | 70 | '("Set coding system of process" . set-current-process-coding-system)) |
| 71 | (define-key mule-keymap [set-keyboard-coding-system] | 71 | (define-key mule-keymap [encoded-kbd-set-coding-system] |
| 72 | '("Set coding system of keyboard" . set-keyboard-coding-system)) | 72 | '("Set coding system for Encoded-kbd mode" . encoded-kbd-set-coding-system)) |
| 73 | (define-key mule-keymap [set-terminal-coding-system] | 73 | (define-key mule-keymap [set-terminal-coding-system] |
| 74 | '("Set coding system of terminal" . set-terminal-coding-system)) | 74 | '("Set coding system of terminal" . set-terminal-coding-system)) |
| 75 | (define-key mule-keymap [set-buffer-file-coding-system] | 75 | (define-key mule-keymap [set-buffer-file-coding-system] |
| @@ -94,12 +94,11 @@ | |||
| 94 | '("Disable/enable multibyte character" . toggle-enable-multibyte-characters)) | 94 | '("Disable/enable multibyte character" . toggle-enable-multibyte-characters)) |
| 95 | 95 | ||
| 96 | ;; These are meaningless when running under X. | 96 | ;; These are meaningless when running under X. |
| 97 | (put 'set-keyboard-coding-system 'menu-enable | 97 | (put 'encoded-kbd-set-coding-system 'menu-enable |
| 98 | '(null window-system)) | 98 | '(null window-system)) |
| 99 | (put 'set-terminal-coding-system 'menu-enable | 99 | (put 'set-terminal-coding-system 'menu-enable |
| 100 | '(null window-system)) | 100 | '(null window-system)) |
| 101 | 101 | ||
| 102 | |||
| 103 | ;; This should be a single character key binding because users use it | 102 | ;; This should be a single character key binding because users use it |
| 104 | ;; very frequently while editing multilingual text. Now we can use | 103 | ;; very frequently while editing multilingual text. Now we can use |
| 105 | ;; only two such keys: "\C-\\" and "\C-^", but the latter is not | 104 | ;; only two such keys: "\C-\\" and "\C-^", but the latter is not |
| @@ -145,24 +144,11 @@ to KEY.") | |||
| 145 | "Return the information for LANGUAGE-NAME of the kind KEY. | 144 | "Return the information for LANGUAGE-NAME of the kind KEY. |
| 146 | LANGUAGE-NAME is a string. | 145 | LANGUAGE-NAME is a string. |
| 147 | KEY is a symbol denoting the kind of required information." | 146 | KEY is a symbol denoting the kind of required information." |
| 148 | (let ((lang-slot (assoc language-name language-info-alist))) | 147 | (let ((lang-slot (assoc-ignore-case |
| 148 | (downcase language-name) language-info-alist))) | ||
| 149 | (if lang-slot | 149 | (if lang-slot |
| 150 | (cdr (assq key (cdr lang-slot)))))) | 150 | (cdr (assq key (cdr lang-slot)))))) |
| 151 | 151 | ||
| 152 | ;; Return a lambda form which calls `describe-language-support' with | ||
| 153 | ;; argument LANG. | ||
| 154 | (defun build-describe-language-support-function (lang) | ||
| 155 | `(lambda () | ||
| 156 | (interactive) | ||
| 157 | (describe-language-support ,lang))) | ||
| 158 | |||
| 159 | ;; Return a lambda form which calls `set-language-environment' with | ||
| 160 | ;; argument LANG. | ||
| 161 | (defun build-set-language-environment-function (lang) | ||
| 162 | `(lambda () | ||
| 163 | (interactive) | ||
| 164 | (set-language-environment ,lang))) | ||
| 165 | |||
| 166 | (defun set-language-info (language-name key info) | 152 | (defun set-language-info (language-name key info) |
| 167 | "Set for LANGUAGE-NAME the information INFO under KEY. | 153 | "Set for LANGUAGE-NAME the information INFO under KEY. |
| 168 | LANGUAGE-NAME is a string | 154 | LANGUAGE-NAME is a string |
| @@ -172,18 +158,20 @@ INFO is any Lisp object which contains the actual information. | |||
| 172 | Currently, the following KEYs are used by Emacs: | 158 | Currently, the following KEYs are used by Emacs: |
| 173 | charset: list of symbols whose values are charsets specific to the language. | 159 | charset: list of symbols whose values are charsets specific to the language. |
| 174 | coding-system: list of coding systems specific to the langauge. | 160 | coding-system: list of coding systems specific to the langauge. |
| 175 | setup-function: see the documentation of `set-language-environment'. | ||
| 176 | tutorial: a tutorial file name written in the language. | 161 | tutorial: a tutorial file name written in the language. |
| 177 | sample-text: one line short text containing characters of the language. | 162 | sample-text: one line short text containing characters of the language. |
| 178 | documentation: a docstring describing how the language is supported, | ||
| 179 | or a fuction to call to describe it, | ||
| 180 | or t which means call `describe-language-support' to describe it. | ||
| 181 | input-method: alist of input method names for the language vs information | 163 | input-method: alist of input method names for the language vs information |
| 182 | for activating them. Use `register-input-method' (which see) | 164 | for activating them. Use `register-input-method' (which see) |
| 183 | to add a new input method to the alist. | 165 | to add a new input method to the alist. |
| 184 | 166 | documentation: a string describing how Emacs supports the langauge. | |
| 185 | Emacs will use more KEYs in the future. To avoid the conflition, users | 167 | describe-function: a function to call for descriebing how Emacs supports |
| 186 | should use prefix \"user-\" in the name of KEY." | 168 | the language. The function uses information listed abobe. |
| 169 | setup-function: a function to call for setting up environment | ||
| 170 | convenient for the language. | ||
| 171 | |||
| 172 | Emacs will use more KEYs in the future. To avoid conflict, users | ||
| 173 | should use prefix \"user-\" in the name of KEY if he wants to set | ||
| 174 | different kind of information." | ||
| 187 | (let (lang-slot key-slot) | 175 | (let (lang-slot key-slot) |
| 188 | (setq lang-slot (assoc language-name language-info-alist)) | 176 | (setq lang-slot (assoc language-name language-info-alist)) |
| 189 | (if (null lang-slot) ; If no slot for the language, add it. | 177 | (if (null lang-slot) ; If no slot for the language, add it. |
| @@ -196,16 +184,16 @@ should use prefix \"user-\" in the name of KEY." | |||
| 196 | (setcdr lang-slot (cons key-slot (cdr lang-slot))))) | 184 | (setcdr lang-slot (cons key-slot (cdr lang-slot))))) |
| 197 | (setcdr key-slot info) | 185 | (setcdr key-slot info) |
| 198 | ;; Setup menu. | 186 | ;; Setup menu. |
| 199 | (cond ((eq key 'documentation) | 187 | (cond ((eq key 'describe-function) |
| 200 | (define-key mule-describe-language-support-map | 188 | (define-key-after mule-describe-language-support-map |
| 201 | (vector (intern language-name)) | 189 | (vector (intern language-name)) |
| 202 | (cons language-name | 190 | (cons language-name info) |
| 203 | (build-describe-language-support-function language-name)))) | 191 | t)) |
| 204 | ((eq key 'setup-function) | 192 | ((eq key 'setup-function) |
| 205 | (define-key mule-set-language-environment-map | 193 | (define-key-after mule-set-language-environment-map |
| 206 | (vector (intern language-name)) | 194 | (vector (intern language-name)) |
| 207 | (cons language-name | 195 | (cons language-name info) |
| 208 | (build-set-language-environment-function language-name))))) | 196 | t))) |
| 209 | )) | 197 | )) |
| 210 | 198 | ||
| 211 | (defun set-language-info-alist (language-name alist) | 199 | (defun set-language-info-alist (language-name alist) |
| @@ -224,8 +212,9 @@ ALIST is an alist of KEY and INFO. See the documentation of | |||
| 224 | (function (lambda (elm) (assq key elm))) | 212 | (function (lambda (elm) (assq key elm))) |
| 225 | t | 213 | t |
| 226 | initial-input))) | 214 | initial-input))) |
| 227 | (and (> (length name) 0) | 215 | (if (and (> (length name) 0) |
| 228 | (car (assoc-ignore-case (downcase name) language-info-alist))))) | 216 | (get-language-info name key)) |
| 217 | name))) | ||
| 229 | 218 | ||
| 230 | ;;; Multilingual input methods. | 219 | ;;; Multilingual input methods. |
| 231 | 220 | ||
| @@ -238,7 +227,7 @@ If nil, it means no input method is activated now.") | |||
| 238 | 227 | ||
| 239 | (defvar current-input-method-title nil | 228 | (defvar current-input-method-title nil |
| 240 | "Title string of the current input method shown in mode line. | 229 | "Title string of the current input method shown in mode line. |
| 241 | Every input method should set this an appropriate value when activated.") | 230 | Every input method should set this to an appropriate value when activated.") |
| 242 | (make-variable-buffer-local 'current-input-method-title) | 231 | (make-variable-buffer-local 'current-input-method-title) |
| 243 | (put 'current-input-method-title 'permanent-local t) | 232 | (put 'current-input-method-title 'permanent-local t) |
| 244 | 233 | ||
| @@ -338,9 +327,10 @@ Arguments for the function are METHOD-NAME and ARGs." | |||
| 338 | (error "No input method `%s' for %s" method-name language-name)) | 327 | (error "No input method `%s' for %s" method-name language-name)) |
| 339 | (if current-input-method | 328 | (if current-input-method |
| 340 | (progn | 329 | (progn |
| 341 | (if (not (equal previous-input-method current-input-method)) | 330 | (setq previous-input-method current-input-method) |
| 342 | (setq previous-input-method current-input-method)) | 331 | (unwind-protect |
| 343 | (funcall inactivate-current-input-method-function))) | 332 | (funcall inactivate-current-input-method-function) |
| 333 | (setq current-input-method nil)))) | ||
| 344 | (setq method-slot (cdr method-slot)) | 334 | (setq method-slot (cdr method-slot)) |
| 345 | (apply (car method-slot) method-name (cdr method-slot)) | 335 | (apply (car method-slot) method-name (cdr method-slot)) |
| 346 | (setq default-input-method | 336 | (setq default-input-method |
| @@ -411,9 +401,9 @@ inputting at minibuffer if this flag is t.") | |||
| 411 | 401 | ||
| 412 | ;;; Language specific setup functions. | 402 | ;;; Language specific setup functions. |
| 413 | (defun set-language-environment (language-name) | 403 | (defun set-language-environment (language-name) |
| 414 | "Setup a user's environment for LANGUAGE-NAME. | 404 | "Setup multilingual environment convenient for LANGUAGE-NAME. |
| 415 | 405 | ||
| 416 | To setup, a fucntion returned by: | 406 | For that, a fucntion returned by: |
| 417 | (get-language-info LANGUAGE-NAME 'setup-function) | 407 | (get-language-info LANGUAGE-NAME 'setup-function) |
| 418 | is called." | 408 | is called." |
| 419 | (interactive (list (read-language-name 'setup-function "Language: "))) | 409 | (interactive (list (read-language-name 'setup-function "Language: "))) |
| @@ -430,52 +420,59 @@ is called." | |||
| 430 | (princ "\n")) | 420 | (princ "\n")) |
| 431 | 421 | ||
| 432 | (defun describe-language-support (language-name) | 422 | (defun describe-language-support (language-name) |
| 433 | "Show documentation about how Emacs supports LANGUAGE-NAME." | 423 | "Describe how Emacs supports LANGUAGE-NAME. |
| 424 | |||
| 425 | For that, a function returned by: | ||
| 426 | (get-language-info LANGUAGE-NAME 'describe-function) | ||
| 427 | is called." | ||
| 434 | (interactive (list (read-language-name 'documentation "Language: "))) | 428 | (interactive (list (read-language-name 'documentation "Language: "))) |
| 435 | (let (doc) | 429 | (let (func) |
| 436 | (if (or (null language-name) | 430 | (if (or (null language-name) |
| 437 | (null (setq doc | 431 | (null (setq func |
| 438 | (get-language-info language-name 'documentation)))) | 432 | (get-language-info language-name 'describe-function)))) |
| 439 | (error "No documentation for the specified language")) | 433 | (error "No documentation for the specified language")) |
| 440 | (with-output-to-temp-buffer "*Help*" | 434 | (funcall func))) |
| 441 | (if (not (eq doc t)) | 435 | |
| 442 | (cond ((stringp doc) | 436 | ;; Print LANGUAGE-NAME specific information such as input methods, |
| 443 | (princ doc)) | 437 | ;; charsets, and coding systems. This function is intended to be |
| 444 | ((and (symbolp doc) (fboundp doc)) | 438 | ;; called from various describe-LANGUAGE-support functions defined in |
| 445 | (funcall doc)) | 439 | ;; lisp/language/LANGUAGE.el. |
| 446 | (t | 440 | (defun describe-language-support-internal (language-name) |
| 447 | (error "Invalid documentation data for %s" language-name))) | 441 | (with-output-to-temp-buffer "*Help*" |
| 448 | (princ-list "List of items specific to " | 442 | (let ((doc (get-language-info language-name 'documentation))) |
| 449 | language-name | 443 | (if (stringp doc) |
| 450 | " environment") | 444 | (princ-list doc))) |
| 451 | (princ "-----------------------------------------------------------\n") | 445 | (princ "-----------------------------------------------------------\n") |
| 452 | (let ((str (get-language-info language-name 'sample-text))) | 446 | (princ-list "List of items specific to " |
| 453 | (if (stringp str) | 447 | language-name |
| 454 | (progn | 448 | " support") |
| 455 | (princ "<sample text>\n") | 449 | (princ "-----------------------------------------------------------\n") |
| 456 | (princ-list " " str)))) | 450 | (let ((str (get-language-info language-name 'sample-text))) |
| 457 | (princ "<input methods>\n") | 451 | (if (stringp str) |
| 458 | (let ((l (get-language-info language-name 'input-method))) | 452 | (progn |
| 459 | (while l | 453 | (princ "<sample text>\n") |
| 460 | (princ-list " " (car (car l))) | 454 | (princ-list " " str)))) |
| 461 | (setq l (cdr l)))) | 455 | (princ "<input methods>\n") |
| 462 | (princ "<character sets>\n") | 456 | (let ((l (get-language-info language-name 'input-method))) |
| 463 | (let ((l (get-language-info language-name 'charset))) | 457 | (while l |
| 464 | (if (null l) | 458 | (princ-list " " (car (car l))) |
| 465 | (princ-list " nothing specific to " language-name) | 459 | (setq l (cdr l)))) |
| 466 | (while l | 460 | (princ "<character sets>\n") |
| 467 | (princ-list " " (car l) | 461 | (let ((l (get-language-info language-name 'charset))) |
| 468 | (format ":%3d:\n\t" (charset-id (car l))) | 462 | (if (null l) |
| 469 | (charset-description (car l))) | 463 | (princ-list " nothing specific to " language-name) |
| 470 | (setq l (cdr l))))) | 464 | (while l |
| 471 | (princ "<coding systems>\n") | 465 | (princ-list " " (car l) ": " |
| 472 | (let ((l (get-language-info language-name 'coding-system))) | 466 | (charset-description (car l))) |
| 473 | (if (null l) | 467 | (setq l (cdr l))))) |
| 474 | (princ-list " nothing specific to " language-name) | 468 | (princ "<coding systems>\n") |
| 475 | (while l | 469 | (let ((l (get-language-info language-name 'coding-system))) |
| 476 | (princ-list " " (car l) ":\n\t" | 470 | (if (null l) |
| 477 | (coding-system-docstring (car l))) | 471 | (princ-list " nothing specific to " language-name) |
| 478 | (setq l (cdr l))))))))) | 472 | (while l |
| 473 | (princ-list " " (car l) ":\n\t" | ||
| 474 | (coding-system-docstring (car l))) | ||
| 475 | (setq l (cdr l))))))) | ||
| 479 | 476 | ||
| 480 | ;;; Charset property | 477 | ;;; Charset property |
| 481 | 478 | ||