diff lisp/mule/mule-cmds.el @ 5565:48a3d3281b48

Pass eighth bit on TTY consoles to coding system if needed. src/ChangeLog addition: 2011-09-06 Aidan Kehoe <kehoea@parhasard.net> * redisplay-tty.c (init_tty_for_redisplay): Only set the console meta key flag to treat the eight bit as meta if the native coding system doesn't need that. * general-slots.h: * mule-coding.c: * mule-coding.c (syms_of_mule_coding): Move Qiso2022, Qseven to general-slots.h, they're now used in redisplay-tty.c. lisp/ChangeLog addition: 2011-09-06 Aidan Kehoe <kehoea@parhasard.net> * mule/mule-cmds.el (set-language-environment-coding-systems): Set the input mode for TTY consoles to use the eighth bit for character information if the native coding system for the language environment needs that.
author Aidan Kehoe <kehoea@parhasard.net>
date Tue, 06 Sep 2011 11:44:50 +0100
parents ac37a5f7e5be
children 3bc58dc9d688
line wrap: on
line diff
--- a/lisp/mule/mule-cmds.el	Mon Sep 05 20:18:05 2011 +0100
+++ b/lisp/mule/mule-cmds.el	Tue Sep 06 11:44:50 2011 +0100
@@ -1385,7 +1385,8 @@
 
     ;; set the native coding system and the default process-output system.
     (let ((native (get-native-coding-system-from-language-environment
-		   language-name (current-locale))))
+		   language-name (current-locale)))
+          seven current-input-mode)
 
       (condition-case nil
 	  (define-coding-system-alias 'native
@@ -1405,15 +1406,20 @@
             ;; native coding system of the language environment.
             keyboard-coding-system native
 	    terminal-coding-system native)
-
-      ;; And do the same for any TTYs. 
-      (dolist (con (console-list))
-	(when (eq 'tty (device-type (car (console-device-list con))))
-	  ;; Calling set-input-mode at the same time would be a sane thing
-	  ;; to do here. I would prefer to default to accepting eight bit
-	  ;; input and not using the top bit for Meta.
-	  (set-console-tty-coding-system con native)))
-
+      ;; Does this coding system use bit 8?
+      (setq seven (and (eq (coding-system-type native) 'iso2022)
+                       (coding-system-property native 'seven)))
+      ;; Set the coding system for TTY consoles.
+      (dolist (console
+               (delete* 'tty (console-list) :key #'console-type :test-not #'eq))
+        (set-console-tty-coding-system console native)
+        (unless seven 
+          ;; The native coding system uses bit 8, so we need to use that bit
+          ;; for character information, not for meta.
+          (setq current-input-mode (current-input-mode console))
+          (and (memq (second current-input-mode) '(nil t))
+               (set-input-mode nil (first current-input-mode) 'character
+                               (third current-input-mode) console))))
       ;; process output should not have EOL conversion.  under MS Windows
       ;; and Cygwin, this screws things up (`cmd' is fine with just LF and
       ;; `bash' chokes on CR-LF).