emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp/international mule.el


From: Kenichi Handa
Subject: [Emacs-diffs] emacs/lisp/international mule.el
Date: Wed, 01 Jul 2009 11:40:04 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Kenichi Handa <handa>   09/07/01 11:40:04

Modified files:
        lisp/international: mule.el 

Log message:
        (set-keyboard-coding-system): Perform the
        necessary setup here instead of calling encoded-kbd-setup-display.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/international/mule.el?cvsroot=emacs&r1=1.284&r2=1.285

Patches:
Index: mule.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/international/mule.el,v
retrieving revision 1.284
retrieving revision 1.285
diff -u -b -r1.284 -r1.285
--- mule.el     20 May 2009 02:17:56 -0000      1.284
+++ mule.el     1 Jul 2009 11:40:03 -0000       1.285
@@ -1268,36 +1268,57 @@
 
 (defun set-keyboard-coding-system (coding-system &optional terminal)
   "Set coding system for keyboard input on TERMINAL to CODING-SYSTEM.
-In addition, this command calls `encoded-kbd-setup-display' to set up the
-translation of keyboard input events to the specified coding system.
 
 For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems].
 The default is determined by the selected language environment
 or by the previous use of this command.
 
+If CODING-SYSTEM is nil or the coding-type of CODING-SYSTEM is
+`raw-text', the decoding of keyboard input is disabled.
+
 TERMINAL may be a terminal object, a frame, or nil for the
 selected frame's terminal.  The setting has no effect on
 graphical terminals."
   (interactive
-   (list (let ((default (if (and (not (keyboard-coding-system))
-                                default-keyboard-coding-system)
+   (list (let* ((coding (keyboard-coding-system nil))
+               (default (if (eq (coding-system-type coding) 'raw-text)
                            default-keyboard-coding-system)))
           (read-coding-system
            (format "Coding system for keyboard input (default %s): "
                    default)
            default))))
-  (if (and (not coding-system)
-          (not (keyboard-coding-system)))
-      (setq coding-system default-keyboard-coding-system))
-  (if coding-system
-      (setq default-keyboard-coding-system coding-system))
-  (if (and coding-system
-          (not (coding-system-get coding-system :ascii-compatible-p))
-          (not (coding-system-get coding-system :suitable-for-keyboard)))
-      (error "%s is not suitable for keyboard" coding-system))
+  (let ((coding-type (coding-system-type coding-system))
+       (saved-meta-mode
+        (terminal-parameter terminal 'keyboard-coding-saved-meta-mode)))
+    (if (not (eq coding-type 'raw-text))
+       (let (accept-8-bit)
+         (if (not (or (coding-system-get coding-system :suitable-for-keyboard)
+                      (coding-system-get coding-system :ascii-compatible-p)))
+             (error "Unsuitable coding system for keyboard: %s" coding-system))
+         (cond ((memq coding-type '(charset utf-8 shift-jis big5 ccl))
+                (setq accept-8-bit t))
+               ((eq coding-type 'iso-2022)
+                (let ((flags (coding-system-get coding-system :flags)))
+                  (or (memq '7-bit flags)
+                      (setq accept-8-bit t))))
+               (t
+                (error "Unsupported coding system for keyboard: %s"
+                       coding-system)))
+         (when accept-8-bit
+           (or saved-meta-mode
+               (set-terminal-parameter terminal
+                                       'keyboard-coding-saved-meta-mode
+                                       (cons (nth 2 (current-input-mode))
+                                             nil)))
+           (set-input-meta-mode 8)))
+
+      (when saved-meta-mode
+       (set-input-meta-mode (car saved-meta-mode))
+       (set-terminal-parameter terminal
+                               'keyboard-coding-saved-meta-mode
+                               nil))))
   (set-keyboard-coding-system-internal coding-system terminal)
-  (setq keyboard-coding-system coding-system)
-  (encoded-kbd-setup-display terminal))
+  (setq keyboard-coding-system coding-system))
 
 (defcustom keyboard-coding-system nil
   "Specify coding system for keyboard input.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]