diff options
| author | Kenichi Handa | 1997-07-15 08:24:47 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-07-15 08:24:47 +0000 |
| commit | b4fba33feb3ef3ad3495b3353a410d2f6f134e78 (patch) | |
| tree | 997c798704666b8cf1904eb50f4e76f5a38b20d5 | |
| parent | 29742cb59dba2d8e0f485036c7a6b1e572b55fba (diff) | |
| download | emacs-b4fba33feb3ef3ad3495b3353a410d2f6f134e78.tar.gz emacs-b4fba33feb3ef3ad3495b3353a410d2f6f134e78.zip | |
(mule-keymap): Bind l to set-language-environment.
(set-language-environment): Remove autoload cookie. Accept null input
for resetting to default.
(select-input-method): Signal error if enable-multibyte-characters is
nil.
(toggle-input-method): Likewise.
| -rw-r--r-- | lisp/international/mule-cmds.el | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 3291f49e72d..f53fe961d1c 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | (define-key mule-keymap "p" 'set-buffer-process-coding-system) | 40 | (define-key mule-keymap "p" 'set-buffer-process-coding-system) |
| 41 | (define-key mule-keymap "\C-\\" 'select-input-method) | 41 | (define-key mule-keymap "\C-\\" 'select-input-method) |
| 42 | (define-key mule-keymap "c" 'universal-coding-system-argument) | 42 | (define-key mule-keymap "c" 'universal-coding-system-argument) |
| 43 | (define-key mule-keymap "l" 'set-language-environment) | ||
| 43 | 44 | ||
| 44 | (define-key help-map "\C-L" 'describe-language-environment) | 45 | (define-key help-map "\C-L" 'describe-language-environment) |
| 45 | (define-key help-map "L" 'describe-language-environment) | 46 | (define-key help-map "L" 'describe-language-environment) |
| @@ -141,6 +142,9 @@ | |||
| 141 | ;; but it won't be used that frequently. | 142 | ;; but it won't be used that frequently. |
| 142 | (define-key global-map "\C-\\" 'toggle-input-method) | 143 | (define-key global-map "\C-\\" 'toggle-input-method) |
| 143 | 144 | ||
| 145 | ;; Here's an alternative key binding for X users (Shift-SPACE). | ||
| 146 | (define-key global-map [?\S- ] 'toggle-input-method) | ||
| 147 | |||
| 144 | (defun toggle-enable-multibyte-characters (&optional arg) | 148 | (defun toggle-enable-multibyte-characters (&optional arg) |
| 145 | "Change whether this buffer enables multibyte characters. | 149 | "Change whether this buffer enables multibyte characters. |
| 146 | With arg, make them enable iff arg is positive." | 150 | With arg, make them enable iff arg is positive." |
| @@ -344,10 +348,13 @@ If nil, it means no input method is activated now.") | |||
| 344 | (make-variable-buffer-local 'current-input-method-title) | 348 | (make-variable-buffer-local 'current-input-method-title) |
| 345 | (put 'current-input-method-title 'permanent-local t) | 349 | (put 'current-input-method-title 'permanent-local t) |
| 346 | 350 | ||
| 347 | (defvar default-input-method nil | 351 | (defcustom default-input-method nil |
| 348 | "Default input method for multilingual text. | 352 | "*Default input method for multilingual text. |
| 349 | The default input method is the one activated automatically by the command | 353 | This is the input method activated automatically by the command |
| 350 | `toggle-input-method' (\\[toggle-input-method]).") | 354 | `toggle-input-method' (\\[toggle-input-method]). |
| 355 | Automatically local in all buffers." | ||
| 356 | :group 'mule) | ||
| 357 | |||
| 351 | (make-variable-buffer-local 'default-input-method) | 358 | (make-variable-buffer-local 'default-input-method) |
| 352 | (put 'default-input-method 'permanent-local t) | 359 | (put 'default-input-method 'permanent-local t) |
| 353 | 360 | ||
| @@ -440,6 +447,8 @@ See also the function `register-input-method'." | |||
| 440 | (interactive | 447 | (interactive |
| 441 | (let* ((default (or previous-input-method default-input-method)) | 448 | (let* ((default (or previous-input-method default-input-method)) |
| 442 | (initial (if default (cons default 0)))) | 449 | (initial (if default (cons default 0)))) |
| 450 | (if (not enable-multibyte-characters) | ||
| 451 | (error "Can't activate any input method while enable-multibyte-characters is nil")) | ||
| 443 | (list (read-input-method-name "Input method: " initial t)))) | 452 | (list (read-input-method-name "Input method: " initial t)))) |
| 444 | (activate-input-method input-method) | 453 | (activate-input-method input-method) |
| 445 | (setq-default default-input-method default-input-method)) | 454 | (setq-default default-input-method default-input-method)) |
| @@ -454,15 +463,14 @@ interactively." | |||
| 454 | (interactive "P") | 463 | (interactive "P") |
| 455 | (let* ((default (or previous-input-method default-input-method)) | 464 | (let* ((default (or previous-input-method default-input-method)) |
| 456 | (initial (if default (cons default 0)))) | 465 | (initial (if default (cons default 0)))) |
| 457 | (if arg | 466 | (if (and current-input-method (not arg)) |
| 458 | (activate-input-method | 467 | (inactivate-input-method) |
| 459 | (read-input-method-name "Input method: " initial t)) | 468 | (if (not enable-multibyte-characters) |
| 460 | (if current-input-method | 469 | (error "Can't activate any input method while enable-multibyte-characters is nil")) |
| 461 | (inactivate-input-method) | 470 | (activate-input-method |
| 462 | (if default-input-method | 471 | (if (or arg (not default-input-method)) |
| 463 | (activate-input-method default-input-method) | 472 | (read-input-method-name "Input method: " initial t) |
| 464 | (activate-input-method | 473 | default-input-method))))) |
| 465 | (read-input-method-name "Input method: " initial t))))))) | ||
| 466 | 474 | ||
| 467 | (defun describe-input-method (input-method) | 475 | (defun describe-input-method (input-method) |
| 468 | "Describe the current input method." | 476 | "Describe the current input method." |
| @@ -538,16 +546,15 @@ inputting at minibuffer if this flag is t.") | |||
| 538 | (defvar current-language-environment "English" | 546 | (defvar current-language-environment "English" |
| 539 | "The last language environment specified with `set-language-environment'.") | 547 | "The last language environment specified with `set-language-environment'.") |
| 540 | 548 | ||
| 541 | ;;;###autoload | ||
| 542 | (defun set-language-environment (language-name) | 549 | (defun set-language-environment (language-name) |
| 543 | "Set up multi-lingual environment for using LANGUAGE-NAME. | 550 | "Set up multi-lingual environment for using LANGUAGE-NAME. |
| 544 | This sets the coding system priority and the default input method | 551 | This sets the coding system priority and the default input method |
| 545 | and sometimes other things." | 552 | and sometimes other things." |
| 546 | (interactive (list (read-language-name 'setup-function "Language: "))) | 553 | (interactive (list (read-language-name 'setup-function |
| 547 | (if (member (downcase language-name) '("default")) | 554 | "Language (null for default): "))) |
| 548 | (setq language-name "english")) | 555 | (or language-name |
| 549 | (if (or (null language-name) | 556 | (setq language-name "English")) |
| 550 | (null (get-language-info language-name 'setup-function))) | 557 | (if (null (get-language-info language-name 'setup-function)) |
| 551 | (error "Language environment not defined: %S" language-name)) | 558 | (error "Language environment not defined: %S" language-name)) |
| 552 | (funcall (get-language-info language-name 'setup-function)) | 559 | (funcall (get-language-info language-name 'setup-function)) |
| 553 | (setq current-language-environment language-name) | 560 | (setq current-language-environment language-name) |