diff options
| author | Karoly Lorentey | 2005-05-03 01:49:33 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-05-03 01:49:33 +0000 |
| commit | 68bba4e4b3ced56b5608ee0495f94d24e7e3f40c (patch) | |
| tree | 43067ff161298f52824bd833e6d16b65dddf23e9 /src | |
| parent | 941d4811d5b6660e2cdb5f668d52792c7e5920e8 (diff) | |
| download | emacs-68bba4e4b3ced56b5608ee0495f94d24e7e3f40c.tar.gz emacs-68bba4e4b3ced56b5608ee0495f94d24e7e3f40c.zip | |
Fix UTF-8 tty input when first frame is an X frame. Steps towards multiple tty locale support.
* lisp/international/mule-cmds.el (set-locale-environment): Ignore
window-system; always set the keyboard coding system.
* src/termhooks.h (DISPLAY_TERMINAL_CODING, DISPLAY_KEYBOARD_CODING): New macros.
* src/coding.c (Fset_terminal_coding_system_internal, Fterminal_coding_system)
(Fset_keyboard_coding_system_internal, Fkeyboard_coding_system): Add DISPLAY
parameter.
* src/term.c (get_display): Add THROW parameter.
(get_tty_display, Fdisplay_name, Fdisplay_tty_type, Fdisplay_controlling_tty_p)
(Fdelete_display, Fdisplay_live_p): Update callers.
* src/xfns.c (check_x_display_info): Ditto.
* src/frame.c (Fmake_terminal_frame, Fframe_display): Ditto.
* src/dispextern.h (get_display): Update prototype.
* lisp/international/mule.el (set-terminal-coding-system)
(set-keyboard-coding-system): Add DISPLAY parameter.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-338
Diffstat (limited to 'src')
| -rw-r--r-- | src/coding.c | 35 | ||||
| -rw-r--r-- | src/dispextern.h | 2 | ||||
| -rw-r--r-- | src/frame.c | 6 | ||||
| -rw-r--r-- | src/term.c | 44 | ||||
| -rw-r--r-- | src/termhooks.h | 3 | ||||
| -rw-r--r-- | src/xfns.c | 4 |
6 files changed, 49 insertions, 45 deletions
diff --git a/src/coding.c b/src/coding.c index b914574bbca..f7da394def1 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -7305,12 +7305,13 @@ Return the corresponding character code in Big5. */) | |||
| 7305 | } | 7305 | } |
| 7306 | 7306 | ||
| 7307 | DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_internal, | 7307 | DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_internal, |
| 7308 | Sset_terminal_coding_system_internal, 1, 1, 0, | 7308 | Sset_terminal_coding_system_internal, 1, 2, 0, |
| 7309 | doc: /* Internal use only. */) | 7309 | doc: /* Internal use only. */) |
| 7310 | (coding_system) | 7310 | (coding_system, display) |
| 7311 | Lisp_Object coding_system; | 7311 | Lisp_Object coding_system; |
| 7312 | Lisp_Object display; | ||
| 7312 | { | 7313 | { |
| 7313 | struct coding_system *terminal_coding = FRAME_TERMINAL_CODING (SELECTED_FRAME ()); | 7314 | struct coding_system *terminal_coding = DISPLAY_TERMINAL_CODING (get_display (display, 1)); |
| 7314 | CHECK_SYMBOL (coding_system); | 7315 | CHECK_SYMBOL (coding_system); |
| 7315 | setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding); | 7316 | setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding); |
| 7316 | /* We had better not send unsafe characters to terminal. */ | 7317 | /* We had better not send unsafe characters to terminal. */ |
| @@ -7343,33 +7344,39 @@ DEFUN ("set-safe-terminal-coding-system-internal", Fset_safe_terminal_coding_sys | |||
| 7343 | } | 7344 | } |
| 7344 | 7345 | ||
| 7345 | DEFUN ("terminal-coding-system", Fterminal_coding_system, | 7346 | DEFUN ("terminal-coding-system", Fterminal_coding_system, |
| 7346 | Sterminal_coding_system, 0, 0, 0, | 7347 | Sterminal_coding_system, 0, 1, 0, |
| 7347 | doc: /* Return coding system specified for terminal output. */) | 7348 | doc: /* Return coding system specified for terminal output on the given display. |
| 7348 | () | 7349 | DISPLAY may be a display id, a frame, or nil for the selected frame's display. */) |
| 7350 | (display) | ||
| 7351 | Lisp_Object display; | ||
| 7349 | { | 7352 | { |
| 7350 | return FRAME_TERMINAL_CODING (SELECTED_FRAME ())->symbol; | 7353 | return DISPLAY_TERMINAL_CODING (get_display (display, 1))->symbol; |
| 7351 | } | 7354 | } |
| 7352 | 7355 | ||
| 7353 | DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_internal, | 7356 | DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_internal, |
| 7354 | Sset_keyboard_coding_system_internal, 1, 1, 0, | 7357 | Sset_keyboard_coding_system_internal, 1, 2, 0, |
| 7355 | doc: /* Internal use only. */) | 7358 | doc: /* Internal use only. */) |
| 7356 | (coding_system) | 7359 | (coding_system, display) |
| 7357 | Lisp_Object coding_system; | 7360 | Lisp_Object coding_system; |
| 7361 | Lisp_Object display; | ||
| 7358 | { | 7362 | { |
| 7363 | struct display *d = get_display (display, 1); | ||
| 7359 | CHECK_SYMBOL (coding_system); | 7364 | CHECK_SYMBOL (coding_system); |
| 7365 | |||
| 7360 | setup_coding_system (Fcheck_coding_system (coding_system), | 7366 | setup_coding_system (Fcheck_coding_system (coding_system), |
| 7361 | FRAME_KEYBOARD_CODING (SELECTED_FRAME ())); | 7367 | DISPLAY_KEYBOARD_CODING (d)); |
| 7362 | /* Character composition should be disabled. */ | 7368 | /* Character composition should be disabled. */ |
| 7363 | FRAME_KEYBOARD_CODING (SELECTED_FRAME ())->composing = COMPOSITION_DISABLED; | 7369 | DISPLAY_KEYBOARD_CODING (d)->composing = COMPOSITION_DISABLED; |
| 7364 | return Qnil; | 7370 | return Qnil; |
| 7365 | } | 7371 | } |
| 7366 | 7372 | ||
| 7367 | DEFUN ("keyboard-coding-system", Fkeyboard_coding_system, | 7373 | DEFUN ("keyboard-coding-system", Fkeyboard_coding_system, |
| 7368 | Skeyboard_coding_system, 0, 0, 0, | 7374 | Skeyboard_coding_system, 0, 1, 0, |
| 7369 | doc: /* Return coding system specified for decoding keyboard input. */) | 7375 | doc: /* Return coding system specified for decoding keyboard input. */) |
| 7370 | () | 7376 | (display) |
| 7377 | Lisp_Object display; | ||
| 7371 | { | 7378 | { |
| 7372 | return FRAME_KEYBOARD_CODING (SELECTED_FRAME ())->symbol; | 7379 | return DISPLAY_KEYBOARD_CODING (get_display (display, 1))->symbol; |
| 7373 | } | 7380 | } |
| 7374 | 7381 | ||
| 7375 | 7382 | ||
diff --git a/src/dispextern.h b/src/dispextern.h index abcda4fc731..df6bbd00eec 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2925,7 +2925,7 @@ extern int per_line_cost P_ ((char *)); | |||
| 2925 | extern void calculate_costs P_ ((struct frame *)); | 2925 | extern void calculate_costs P_ ((struct frame *)); |
| 2926 | extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object)); | 2926 | extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object)); |
| 2927 | extern void tty_setup_colors P_ ((struct tty_display_info *, int)); | 2927 | extern void tty_setup_colors P_ ((struct tty_display_info *, int)); |
| 2928 | extern struct display *get_display P_ ((Lisp_Object display)); | 2928 | extern struct display *get_display P_ ((Lisp_Object display, int)); |
| 2929 | extern struct display *get_named_tty_display P_ ((char *)); | 2929 | extern struct display *get_named_tty_display P_ ((char *)); |
| 2930 | EXFUN (Fdisplay_tty_type, 1); | 2930 | EXFUN (Fdisplay_tty_type, 1); |
| 2931 | extern struct display *init_initial_display P_ ((void)); | 2931 | extern struct display *init_initial_display P_ ((void)); |
diff --git a/src/frame.c b/src/frame.c index d0d4b3491e4..f86cb0d43da 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -698,9 +698,7 @@ affects all frames on the same terminal device. */) | |||
| 698 | { | 698 | { |
| 699 | display_device = XCDR (display_device); | 699 | display_device = XCDR (display_device); |
| 700 | CHECK_NUMBER (display_device); | 700 | CHECK_NUMBER (display_device); |
| 701 | d = get_display (XINT (display_device)); | 701 | d = get_display (XINT (display_device), 1); |
| 702 | if (!d) | ||
| 703 | wrong_type_argument (Qdisplay_live_p, display_device); | ||
| 704 | } | 702 | } |
| 705 | } | 703 | } |
| 706 | 704 | ||
| @@ -1073,7 +1071,7 @@ The display device is represented by its integer identifier. */) | |||
| 1073 | 1071 | ||
| 1074 | CHECK_LIVE_FRAME (frame); | 1072 | CHECK_LIVE_FRAME (frame); |
| 1075 | 1073 | ||
| 1076 | d = get_display (frame); | 1074 | d = get_display (frame, 0); |
| 1077 | 1075 | ||
| 1078 | if (!d) | 1076 | if (!d) |
| 1079 | return Qnil; | 1077 | return Qnil; |
diff --git a/src/term.c b/src/term.c index bc30e3fb0d8..9c733a46abb 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -2105,17 +2105,17 @@ set_tty_color_mode (f, val) | |||
| 2105 | 2105 | ||
| 2106 | /* Return the display object specified by DISPLAY. DISPLAY may be a | 2106 | /* Return the display object specified by DISPLAY. DISPLAY may be a |
| 2107 | display id, a frame, or nil for the display device of the current | 2107 | display id, a frame, or nil for the display device of the current |
| 2108 | frame. */ | 2108 | frame. If THROW is zero, return NULL for failure, otherwise throw |
| 2109 | an error. */ | ||
| 2109 | 2110 | ||
| 2110 | struct display * | 2111 | struct display * |
| 2111 | get_display (Lisp_Object display) | 2112 | get_display (Lisp_Object display, int throw) |
| 2112 | { | 2113 | { |
| 2114 | Lisp_Object result = NULL; | ||
| 2115 | |||
| 2113 | if (NILP (display)) | 2116 | if (NILP (display)) |
| 2114 | display = selected_frame; | 2117 | display = selected_frame; |
| 2115 | 2118 | ||
| 2116 | if (! INTEGERP (display) && ! FRAMEP (display)) | ||
| 2117 | return NULL; | ||
| 2118 | |||
| 2119 | if (INTEGERP (display)) | 2119 | if (INTEGERP (display)) |
| 2120 | { | 2120 | { |
| 2121 | struct display *d; | 2121 | struct display *d; |
| @@ -2123,15 +2123,21 @@ get_display (Lisp_Object display) | |||
| 2123 | for (d = display_list; d; d = d->next_display) | 2123 | for (d = display_list; d; d = d->next_display) |
| 2124 | { | 2124 | { |
| 2125 | if (d->id == XINT (display)) | 2125 | if (d->id == XINT (display)) |
| 2126 | return d; | 2126 | { |
| 2127 | result = d; | ||
| 2128 | break; | ||
| 2129 | } | ||
| 2127 | } | 2130 | } |
| 2128 | return NULL; | ||
| 2129 | } | 2131 | } |
| 2130 | else if (FRAMEP (display)) | 2132 | else if (FRAMEP (display)) |
| 2131 | { | 2133 | { |
| 2132 | return FRAME_DISPLAY (XFRAME (display)); | 2134 | result = FRAME_DISPLAY (XFRAME (display)); |
| 2133 | } | 2135 | } |
| 2134 | return NULL; | 2136 | |
| 2137 | if (result == NULL && throw) | ||
| 2138 | wrong_type_argument (Qdisplay_live_p, display); | ||
| 2139 | |||
| 2140 | return result; | ||
| 2135 | } | 2141 | } |
| 2136 | 2142 | ||
| 2137 | /* Return the tty display object specified by DISPLAY. */ | 2143 | /* Return the tty display object specified by DISPLAY. */ |
| @@ -2139,7 +2145,7 @@ get_display (Lisp_Object display) | |||
| 2139 | static struct display * | 2145 | static struct display * |
| 2140 | get_tty_display (Lisp_Object display) | 2146 | get_tty_display (Lisp_Object display) |
| 2141 | { | 2147 | { |
| 2142 | struct display *d = get_display (display); | 2148 | struct display *d = get_display (display, 0); |
| 2143 | 2149 | ||
| 2144 | if (d && d->type == output_initial) | 2150 | if (d && d->type == output_initial) |
| 2145 | d = NULL; | 2151 | d = NULL; |
| @@ -2194,10 +2200,7 @@ frame's display). */) | |||
| 2194 | (display) | 2200 | (display) |
| 2195 | Lisp_Object display; | 2201 | Lisp_Object display; |
| 2196 | { | 2202 | { |
| 2197 | struct display *d = get_display (display); | 2203 | struct display *d = get_display (display, 1); |
| 2198 | |||
| 2199 | if (!d) | ||
| 2200 | wrong_type_argument (Qdisplay_live_p, display); | ||
| 2201 | 2204 | ||
| 2202 | if (d->name) | 2205 | if (d->name) |
| 2203 | return build_string (d->name); | 2206 | return build_string (d->name); |
| @@ -2210,10 +2213,8 @@ DEFUN ("display-tty-type", Fdisplay_tty_type, Sdisplay_tty_type, 0, 1, 0, | |||
| 2210 | (display) | 2213 | (display) |
| 2211 | Lisp_Object display; | 2214 | Lisp_Object display; |
| 2212 | { | 2215 | { |
| 2213 | struct display *d = get_display (display); | 2216 | struct display *d = get_display (display, 1); |
| 2214 | 2217 | ||
| 2215 | if (!d) | ||
| 2216 | wrong_type_argument (Qdisplay_live_p, display); | ||
| 2217 | if (d->type != output_termcap) | 2218 | if (d->type != output_termcap) |
| 2218 | error ("Display %d is not a termcap display", d->id); | 2219 | error ("Display %d is not a termcap display", d->id); |
| 2219 | 2220 | ||
| @@ -2228,10 +2229,7 @@ DEFUN ("display-controlling-tty-p", Fdisplay_controlling_tty_p, Sdisplay_control | |||
| 2228 | (display) | 2229 | (display) |
| 2229 | Lisp_Object display; | 2230 | Lisp_Object display; |
| 2230 | { | 2231 | { |
| 2231 | struct display *d = get_display (display); | 2232 | struct display *d = get_display (display, 1); |
| 2232 | |||
| 2233 | if (!d) | ||
| 2234 | wrong_type_argument (Qdisplay_live_p, display); | ||
| 2235 | 2233 | ||
| 2236 | if (d->type != output_termcap || d->display_info.tty->name) | 2234 | if (d->type != output_termcap || d->display_info.tty->name) |
| 2237 | return Qnil; | 2235 | return Qnil; |
| @@ -3157,7 +3155,7 @@ but if the second argument FORCE is non-nil, you may do so. */) | |||
| 3157 | { | 3155 | { |
| 3158 | struct display *d, *p; | 3156 | struct display *d, *p; |
| 3159 | 3157 | ||
| 3160 | d = get_display (display); | 3158 | d = get_display (display, 0); |
| 3161 | 3159 | ||
| 3162 | if (!d) | 3160 | if (!d) |
| 3163 | return Qnil; | 3161 | return Qnil; |
| @@ -3193,7 +3191,7 @@ Displays are represented by their integer identifiers. */) | |||
| 3193 | if (!INTEGERP (object)) | 3191 | if (!INTEGERP (object)) |
| 3194 | return Qnil; | 3192 | return Qnil; |
| 3195 | 3193 | ||
| 3196 | d = get_display (object); | 3194 | d = get_display (object, 0); |
| 3197 | 3195 | ||
| 3198 | if (!d) | 3196 | if (!d) |
| 3199 | return Qnil; | 3197 | return Qnil; |
diff --git a/src/termhooks.h b/src/termhooks.h index d424ad75e4a..788b57e9d1e 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -550,6 +550,9 @@ extern struct display *display_list; | |||
| 550 | #define FRAME_TERMINAL_CODING(f) ((f)->display->terminal_coding) | 550 | #define FRAME_TERMINAL_CODING(f) ((f)->display->terminal_coding) |
| 551 | #define FRAME_KEYBOARD_CODING(f) ((f)->display->keyboard_coding) | 551 | #define FRAME_KEYBOARD_CODING(f) ((f)->display->keyboard_coding) |
| 552 | 552 | ||
| 553 | #define DISPLAY_TERMINAL_CODING(d) ((d)->terminal_coding) | ||
| 554 | #define DISPLAY_KEYBOARD_CODING(d) ((d)->keyboard_coding) | ||
| 555 | |||
| 553 | #define FRAME_RIF(f) ((f)->display->rif) | 556 | #define FRAME_RIF(f) ((f)->display->rif) |
| 554 | 557 | ||
| 555 | #define FRAME_DISPLAY(f) ((f)->display) | 558 | #define FRAME_DISPLAY(f) ((f)->display) |
diff --git a/src/xfns.c b/src/xfns.c index 6a9ec8a6b47..666acfec773 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -263,10 +263,8 @@ check_x_display_info (frame) | |||
| 263 | } | 263 | } |
| 264 | else if (INTEGERP (frame)) | 264 | else if (INTEGERP (frame)) |
| 265 | { | 265 | { |
| 266 | struct display *d = get_display (XINT (frame)); | 266 | struct display *d = get_display (XINT (frame), 1); |
| 267 | 267 | ||
| 268 | if (!d) | ||
| 269 | wrong_type_argument (Qdisplay_live_p, frame); | ||
| 270 | if (d->type != output_x_window) | 268 | if (d->type != output_x_window) |
| 271 | error ("Display %d is not an X display", XINT (frame)); | 269 | error ("Display %d is not an X display", XINT (frame)); |
| 272 | 270 | ||