diff options
| author | Kenichi Handa | 1997-09-01 07:19:38 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-09-01 07:19:38 +0000 |
| commit | 4ef06f758018521c4825a3ee2812009128053e9e (patch) | |
| tree | d46792c48694bfbdc0e6288a39a1978e2a81acf1 | |
| parent | 6356130450fca57f06a0340c5b26aaa136b1d1d9 (diff) | |
| download | emacs-4ef06f758018521c4825a3ee2812009128053e9e.tar.gz emacs-4ef06f758018521c4825a3ee2812009128053e9e.zip | |
(get-language-info): Accept a symbol
as the arg LANGUAGE-NAME.
(set-language-info): Likewise.
(set-language-info-alist): Likewise.
(register-input-method): Accept a symbol as the args INPUT-METHOD
and LANGUAGE-NAME.
(activate-input-method): Accept a symbol as the args INPUT-METHOD.
(describe-input-method): Likewise.
(read-multilingual-string): Likewise.
(set-language-environment): Accept a symbol as the arg
LANGUAGE-NAME.
(describe-language-environment): Likewise.
| -rw-r--r-- | lisp/international/mule-cmds.el | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index eb92a210fd2..dfc3a686e22 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el | |||
| @@ -229,15 +229,15 @@ to KEY.") | |||
| 229 | 229 | ||
| 230 | (defun get-language-info (language-name key) | 230 | (defun get-language-info (language-name key) |
| 231 | "Return the information for LANGUAGE-NAME of the kind KEY. | 231 | "Return the information for LANGUAGE-NAME of the kind KEY. |
| 232 | LANGUAGE-NAME is a string. | ||
| 233 | KEY is a symbol denoting the kind of required information." | 232 | KEY is a symbol denoting the kind of required information." |
| 233 | (if (symbolp language-name) | ||
| 234 | (setq language-name (symbol-name language-name))) | ||
| 234 | (let ((lang-slot (assoc-ignore-case language-name language-info-alist))) | 235 | (let ((lang-slot (assoc-ignore-case language-name language-info-alist))) |
| 235 | (if lang-slot | 236 | (if lang-slot |
| 236 | (cdr (assq key (cdr lang-slot)))))) | 237 | (cdr (assq key (cdr lang-slot)))))) |
| 237 | 238 | ||
| 238 | (defun set-language-info (language-name key info) | 239 | (defun set-language-info (language-name key info) |
| 239 | "Set for LANGUAGE-NAME the information INFO under KEY. | 240 | "Set for LANGUAGE-NAME the information INFO under KEY. |
| 240 | LANGUAGE-NAME is a string | ||
| 241 | KEY is a symbol denoting the kind of information. | 241 | KEY is a symbol denoting the kind of information. |
| 242 | INFO is any Lisp object which contains the actual information. | 242 | INFO is any Lisp object which contains the actual information. |
| 243 | 243 | ||
| @@ -267,6 +267,8 @@ is actually set as the information. | |||
| 267 | 267 | ||
| 268 | We will define more KEYs in the future. To avoid conflict, | 268 | We will define more KEYs in the future. To avoid conflict, |
| 269 | if you want to use your own KEY values, make them start with `user-'." | 269 | if you want to use your own KEY values, make them start with `user-'." |
| 270 | (if (symbolp language-name) | ||
| 271 | (setq language-name (symbol-name language-name))) | ||
| 270 | (let (lang-slot key-slot) | 272 | (let (lang-slot key-slot) |
| 271 | (setq lang-slot (assoc language-name language-info-alist)) | 273 | (setq lang-slot (assoc language-name language-info-alist)) |
| 272 | (if (null lang-slot) ; If no slot for the language, add it. | 274 | (if (null lang-slot) ; If no slot for the language, add it. |
| @@ -304,12 +306,15 @@ if you want to use your own KEY values, make them start with `user-'." | |||
| 304 | "Set for LANGUAGE-NAME the information in ALIST. | 306 | "Set for LANGUAGE-NAME the information in ALIST. |
| 305 | ALIST is an alist of KEY and INFO. See the documentation of | 307 | ALIST is an alist of KEY and INFO. See the documentation of |
| 306 | `set-langauge-info' for the meanings of KEY and INFO." | 308 | `set-langauge-info' for the meanings of KEY and INFO." |
| 309 | (if (symbolp language-name) | ||
| 310 | (setq language-name (symbol-name language-name))) | ||
| 307 | (while alist | 311 | (while alist |
| 308 | (set-language-info language-name (car (car alist)) (cdr (car alist))) | 312 | (set-language-info language-name (car (car alist)) (cdr (car alist))) |
| 309 | (setq alist (cdr alist)))) | 313 | (setq alist (cdr alist)))) |
| 310 | 314 | ||
| 311 | (defun read-language-name (key prompt &optional initial-input) | 315 | (defun read-language-name (key prompt &optional initial-input) |
| 312 | "Read language name which has information for KEY, prompting with PROMPT." | 316 | "Read language name which has information for KEY, prompting with PROMPT. |
| 317 | It returns a string as language name." | ||
| 313 | (let* ((completion-ignore-case t) | 318 | (let* ((completion-ignore-case t) |
| 314 | (name (completing-read prompt | 319 | (name (completing-read prompt |
| 315 | language-info-alist | 320 | language-info-alist |
| @@ -411,7 +416,7 @@ See the function `register-input-method' for the meanings of each elements.") | |||
| 411 | 416 | ||
| 412 | (defun register-input-method (input-method language-name &rest args) | 417 | (defun register-input-method (input-method language-name &rest args) |
| 413 | "Register INPUT-METHOD as an input method for LANGUAGE-NAME. | 418 | "Register INPUT-METHOD as an input method for LANGUAGE-NAME. |
| 414 | INPUT-METHOD and LANGUAGE-NAME are strings. | 419 | INPUT-METHOD and LANGUAGE-NAME are symbols or strings. |
| 415 | The remaining arguments are: | 420 | The remaining arguments are: |
| 416 | ACTIVATE-FUNC, TITLE, DESCRIPTION, and ARG ... | 421 | ACTIVATE-FUNC, TITLE, DESCRIPTION, and ARG ... |
| 417 | where, | 422 | where, |
| @@ -419,6 +424,10 @@ ACTIVATE-FUNC is a function to call for activating this method. | |||
| 419 | TITLE is a string shown in mode-line while this method is active, | 424 | TITLE is a string shown in mode-line while this method is active, |
| 420 | DESCRIPTION is a string describing about this method, | 425 | DESCRIPTION is a string describing about this method, |
| 421 | Arguments to ACTIVATE-FUNC are INPUT-METHOD and ARGs." | 426 | Arguments to ACTIVATE-FUNC are INPUT-METHOD and ARGs." |
| 427 | (if (symbolp language-name) | ||
| 428 | (setq language-name (symbol-name language-name))) | ||
| 429 | (if (symbolp input-method) | ||
| 430 | (setq input-method (symbol-name input-method))) | ||
| 422 | (let ((info (cons language-name args)) | 431 | (let ((info (cons language-name args)) |
| 423 | (slot (assoc input-method input-method-alist))) | 432 | (slot (assoc input-method input-method-alist))) |
| 424 | (if slot | 433 | (if slot |
| @@ -430,7 +439,9 @@ Arguments to ACTIVATE-FUNC are INPUT-METHOD and ARGs." | |||
| 430 | "Read a name of input method from a minibuffer prompting with PROMPT. | 439 | "Read a name of input method from a minibuffer prompting with PROMPT. |
| 431 | If DEFAULT is non-nil, use that as the default, | 440 | If DEFAULT is non-nil, use that as the default, |
| 432 | and substitute it into PROMPT at the first `%s'. | 441 | and substitute it into PROMPT at the first `%s'. |
| 433 | If INHIBIT-NULL is non-nil, null input signals an error." | 442 | If INHIBIT-NULL is non-nil, null input signals an error. |
| 443 | |||
| 444 | The return value is a string." | ||
| 434 | (if default | 445 | (if default |
| 435 | (setq prompt (format prompt default))) | 446 | (setq prompt (format prompt default))) |
| 436 | (let* ((completion-ignore-case t) | 447 | (let* ((completion-ignore-case t) |
| @@ -447,6 +458,8 @@ If INHIBIT-NULL is non-nil, null input signals an error." | |||
| 447 | (defun activate-input-method (input-method) | 458 | (defun activate-input-method (input-method) |
| 448 | "Turn INPUT-METHOD on. | 459 | "Turn INPUT-METHOD on. |
| 449 | If some input method is already on, turn it off at first." | 460 | If some input method is already on, turn it off at first." |
| 461 | (if (symbolp input-method) | ||
| 462 | (setq input-method (symbol-name input-method))) | ||
| 450 | (if (and current-input-method | 463 | (if (and current-input-method |
| 451 | (not (string= current-input-method input-method))) | 464 | (not (string= current-input-method input-method))) |
| 452 | (inactivate-input-method)) | 465 | (inactivate-input-method)) |
| @@ -515,10 +528,12 @@ When there's no input method to turn on, turn on what read from minibuffer." | |||
| 515 | (setq default-input-method current-input-method))))) | 528 | (setq default-input-method current-input-method))))) |
| 516 | 529 | ||
| 517 | (defun describe-input-method (input-method) | 530 | (defun describe-input-method (input-method) |
| 518 | "Describe the current input method." | 531 | "Describe input method INPUT-METHOD." |
| 519 | (interactive | 532 | (interactive |
| 520 | (list (read-input-method-name | 533 | (list (read-input-method-name |
| 521 | "Describe input method (default, current choice): "))) | 534 | "Describe input method (default, current choice): "))) |
| 535 | (if (symbolp input-method) | ||
| 536 | (setq input-method (symbol-name input-method))) | ||
| 522 | (if (null input-method) | 537 | (if (null input-method) |
| 523 | (describe-current-input-method) | 538 | (describe-current-input-method) |
| 524 | (with-output-to-temp-buffer "*Help*" | 539 | (with-output-to-temp-buffer "*Help*" |
| @@ -544,11 +559,14 @@ The input method selected last time is activated in minibuffer. | |||
| 544 | If optional second arg INITIAL-INPUT is non-nil, insert it in the minibuffer | 559 | If optional second arg INITIAL-INPUT is non-nil, insert it in the minibuffer |
| 545 | initially. | 560 | initially. |
| 546 | Optional 3rd argument INPUT-METHOD specifies the input method | 561 | Optional 3rd argument INPUT-METHOD specifies the input method |
| 547 | to be activated instead of the one selected last time." | 562 | to be activated instead of the one selected last time. It is a symbol |
| 563 | or a string." | ||
| 548 | (setq input-method | 564 | (setq input-method |
| 549 | (or input-method | 565 | (or input-method |
| 550 | default-input-method | 566 | default-input-method |
| 551 | (read-input-method-name "Input method: " nil t))) | 567 | (read-input-method-name "Input method: " nil t))) |
| 568 | (if (symbolp input-method) | ||
| 569 | (setq input-method (symbol-name input-method))) | ||
| 552 | (let ((current-input-method | 570 | (let ((current-input-method |
| 553 | (or input-method | 571 | (or input-method |
| 554 | default-input-method | 572 | default-input-method |
| @@ -618,8 +636,10 @@ This sets the coding system priority and the default input method | |||
| 618 | and sometimes other things." | 636 | and sometimes other things." |
| 619 | (interactive (list (read-language-name 'setup-function | 637 | (interactive (list (read-language-name 'setup-function |
| 620 | "Language (null for default): "))) | 638 | "Language (null for default): "))) |
| 621 | (or language-name | 639 | (if language-name |
| 622 | (setq language-name "English")) | 640 | (if (symbolp language-name) |
| 641 | (setq language-name (symbol-name language-name))) | ||
| 642 | (setq language-name "English")) | ||
| 623 | (if (null (get-language-info language-name 'setup-function)) | 643 | (if (null (get-language-info language-name 'setup-function)) |
| 624 | (error "Language environment not defined: %S" language-name)) | 644 | (error "Language environment not defined: %S" language-name)) |
| 625 | (funcall (get-language-info language-name 'setup-function)) | 645 | (funcall (get-language-info language-name 'setup-function)) |
| @@ -653,6 +673,8 @@ and sometimes other things." | |||
| 653 | (if (or (null language-name) | 673 | (if (or (null language-name) |
| 654 | (null (get-language-info language-name 'documentation))) | 674 | (null (get-language-info language-name 'documentation))) |
| 655 | (error "No documentation for the specified language")) | 675 | (error "No documentation for the specified language")) |
| 676 | (if (symbolp language-name) | ||
| 677 | (setq language-name (symbol-name language-name))) | ||
| 656 | (let ((doc (get-language-info language-name 'documentation))) | 678 | (let ((doc (get-language-info language-name 'documentation))) |
| 657 | (with-output-to-temp-buffer "*Help*" | 679 | (with-output-to-temp-buffer "*Help*" |
| 658 | (if (stringp doc) | 680 | (if (stringp doc) |