Mercurial > emacs
comparison lisp/international/mule-cmds.el @ 91204:53108e6cea98
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-294
author | Miles Bader <miles@gnu.org> |
---|---|
date | Thu, 06 Dec 2007 09:51:45 +0000 |
parents | bdb3fe0ba9fa ec0ef12211d9 |
children | 56a72e2bd635 |
comparison
equal
deleted
inserted
replaced
91203:db40129142b2 | 91204:53108e6cea98 |
---|---|
1457 (setq default-input-method input-method) | 1457 (setq default-input-method input-method) |
1458 (when interactive | 1458 (when interactive |
1459 (customize-mark-as-set 'default-input-method)) | 1459 (customize-mark-as-set 'default-input-method)) |
1460 default-input-method) | 1460 default-input-method) |
1461 | 1461 |
1462 (defvar toggle-input-method-active nil | |
1463 "Non-nil inside `toggle-input-method'.") | |
1464 | |
1462 (defun toggle-input-method (&optional arg interactive) | 1465 (defun toggle-input-method (&optional arg interactive) |
1463 "Enable or disable multilingual text input method for the current buffer. | 1466 "Enable or disable multilingual text input method for the current buffer. |
1464 Only one input method can be enabled at any time in a given buffer. | 1467 Only one input method can be enabled at any time in a given buffer. |
1465 | 1468 |
1466 The normal action is to enable an input method if none was | 1469 The normal action is to enable an input method if none was |
1476 | 1479 |
1477 When called interactively, the optional arg INTERACTIVE is non-nil, | 1480 When called interactively, the optional arg INTERACTIVE is non-nil, |
1478 which marks the variable `default-input-method' as set for Custom buffers." | 1481 which marks the variable `default-input-method' as set for Custom buffers." |
1479 | 1482 |
1480 (interactive "P\np") | 1483 (interactive "P\np") |
1484 (if toggle-input-method-active | |
1485 (error "Recursive use of `toggle-input-method'")) | |
1481 (if (and current-input-method (not arg)) | 1486 (if (and current-input-method (not arg)) |
1482 (inactivate-input-method) | 1487 (inactivate-input-method) |
1483 (let ((default (or (car input-method-history) default-input-method))) | 1488 (let ((toggle-input-method-active t) |
1489 (default (or (car input-method-history) default-input-method))) | |
1484 (if (and arg default (equal current-input-method default) | 1490 (if (and arg default (equal current-input-method default) |
1485 (> (length input-method-history) 1)) | 1491 (> (length input-method-history) 1)) |
1486 (setq default (nth 1 input-method-history))) | 1492 (setq default (nth 1 input-method-history))) |
1487 (activate-input-method | 1493 (activate-input-method |
1488 (if (or arg (not default)) | 1494 (if (or arg (not default)) |
2588 (unless result | 2594 (unless result |
2589 (message "Warning: Default coding system `%s' disagrees with | 2595 (message "Warning: Default coding system `%s' disagrees with |
2590 system codeset `%s' for this locale." coding-system codeset)))))))) | 2596 system codeset `%s' for this locale." coding-system codeset)))))))) |
2591 | 2597 |
2592 ;; On Windows, override locale-coding-system, | 2598 ;; On Windows, override locale-coding-system, |
2593 ;; keyboard-coding-system with system codepage. Note: | 2599 ;; default-file-name-coding-system, keyboard-coding-system, |
2594 ;; selection-coding-system is already set in w32select.c. | 2600 ;; terminal-coding-system with system codepage. |
2595 (when (boundp 'w32-ansi-code-page) | 2601 (when (boundp 'w32-ansi-code-page) |
2596 (let ((code-page-coding (intern (format "cp%d" w32-ansi-code-page)))) | 2602 (let ((code-page-coding (intern (format "cp%d" w32-ansi-code-page)))) |
2597 (when (coding-system-p code-page-coding) | 2603 (when (coding-system-p code-page-coding) |
2598 (unless frame (setq locale-coding-system code-page-coding)) | 2604 (unless frame (setq locale-coding-system code-page-coding)) |
2599 (set-keyboard-coding-system code-page-coding frame) | 2605 (set-keyboard-coding-system code-page-coding frame) |
2600 (set-terminal-coding-system code-page-coding frame)))) | 2606 (set-terminal-coding-system code-page-coding frame) |
2607 ;; Set default-file-name-coding-system last, so that Emacs | |
2608 ;; doesn't try to use cpNNNN when it defines keyboard and | |
2609 ;; terminal encoding. That's because the above two lines | |
2610 ;; will want to load code-pages.el, where cpNNNN are | |
2611 ;; defined; if default-file-name-coding-system were set to | |
2612 ;; cpNNNN while these two lines run, Emacs will want to use | |
2613 ;; it for encoding the file name it wants to load. And that | |
2614 ;; will fail, since cpNNNN is not yet usable until | |
2615 ;; code-pages.el finishes loading. | |
2616 (setq default-file-name-coding-system code-page-coding)))) | |
2601 | 2617 |
2602 (when (eq system-type 'darwin) | 2618 (when (eq system-type 'darwin) |
2603 ;; On Darwin, file names are always encoded in utf-8, no matter | 2619 ;; On Darwin, file names are always encoded in utf-8, no matter |
2604 ;; the locale. | 2620 ;; the locale. |
2605 (setq default-file-name-coding-system 'utf-8) | 2621 (setq default-file-name-coding-system 'utf-8) |