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 | |
| 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
| -rw-r--r-- | README.multi-tty | 49 | ||||
| -rw-r--r-- | lisp/international/mule-cmds.el | 13 | ||||
| -rw-r--r-- | lisp/international/mule.el | 26 | ||||
| -rw-r--r-- | lisp/term/lk201.el | 2 | ||||
| -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 |
10 files changed, 110 insertions, 74 deletions
diff --git a/README.multi-tty b/README.multi-tty index e7602bda7cb..c5230c0ca54 100644 --- a/README.multi-tty +++ b/README.multi-tty | |||
| @@ -383,18 +383,19 @@ THINGS TO DO | |||
| 383 | Update: selecting a region with the mouse enables single_kboard | 383 | Update: selecting a region with the mouse enables single_kboard |
| 384 | under X. This is very confusing. | 384 | under X. This is very confusing. |
| 385 | 385 | ||
| 386 | Update: After discussions with Richard, this will be resolved by | 386 | Update: After discussions with Richard Stallman, this will be |
| 387 | having locked displays warn the user to wait, and introducing a | 387 | resolved by having locked displays warn the user to wait, and |
| 388 | complex protocol to remotely bail out of single-kboard mode by | 388 | introducing a complex protocol to remotely bail out of |
| 389 | pressing C-g. | 389 | single-kboard mode by pressing C-g. |
| 390 | 390 | ||
| 391 | Update: Warning the user is not trivial to implement, as Emacs has | 391 | Update: Warning the user is not trivial to implement, as Emacs has |
| 392 | only one echo area. Ideally the warning should not be displayed on | 392 | only one echo area, shared by all frames. Ideally the warning |
| 393 | the display that is locking the others. Perhaps the high | 393 | should not be displayed on the display that is locking the others. |
| 394 | probability of user confusion caused by single_kboard mode deserves | 394 | Perhaps the high probability of user confusion caused by |
| 395 | a special case in the display code. Alternatively, it might be | 395 | single_kboard mode deserves a special case in the display code. |
| 396 | good enough to signal single_kboard mode by changing the modelines | 396 | Alternatively, it might be good enough to signal single_kboard mode |
| 397 | or some other frame-local display element on the locked out displays. | 397 | by changing the modelines or some other frame-local display element |
| 398 | on the locked out displays. | ||
| 398 | 399 | ||
| 399 | ** normal-erase-is-backspace-mode in simple.el needs to be updated for | 400 | ** normal-erase-is-backspace-mode in simple.el needs to be updated for |
| 400 | multi-tty (rep. by Dan Waber). | 401 | multi-tty (rep. by Dan Waber). |
| @@ -405,6 +406,22 @@ THINGS TO DO | |||
| 405 | ** rif->flush_display_optional (NULL) calls should be replaced by a | 406 | ** rif->flush_display_optional (NULL) calls should be replaced by a |
| 406 | new global function. | 407 | new global function. |
| 407 | 408 | ||
| 409 | ** Support multiple character locales. | ||
| 410 | |||
| 411 | (1) A version of `set-locale-environment' needs to be written | ||
| 412 | for setting up display-local settings on ttys. I think | ||
| 413 | calling set-display-table-and-terminal-coding-system and | ||
| 414 | set-keyboard-coding-system would be enough. The language | ||
| 415 | environment itself should remain a global setting. | ||
| 416 | |||
| 417 | (2) Have a look at Vlocale_coding_system. Seems like it would | ||
| 418 | be a tedious job to localize it, although most references | ||
| 419 | use it for interfacing with libc and are therefore OK with | ||
| 420 | the global definition. | ||
| 421 | |||
| 422 | Exceptions found so far: x-select-text and | ||
| 423 | x-cut-buffer-or-selection-value. | ||
| 424 | |||
| 408 | ** Have a look at fatal_error_hook. | 425 | ** Have a look at fatal_error_hook. |
| 409 | 426 | ||
| 410 | ** Have a look at set_frame_matrix_frame. | 427 | ** Have a look at set_frame_matrix_frame. |
| @@ -429,7 +446,8 @@ THINGS TO DO | |||
| 429 | 446 | ||
| 430 | ** The terminal customization files in term/*.el tend to change global | 447 | ** The terminal customization files in term/*.el tend to change global |
| 431 | parameters, which may confuse Emacs with multiple displays. Change | 448 | parameters, which may confuse Emacs with multiple displays. Change |
| 432 | them to tweak only frame-local settings, if possible. | 449 | them to tweak only frame-local settings, if possible. (They tend |
| 450 | to call define-key to set function key sequences a lot.) | ||
| 433 | 451 | ||
| 434 | ** Dan Nicolaescu suggests that -nw should be added as an alias for -t | 452 | ** Dan Nicolaescu suggests that -nw should be added as an alias for -t |
| 435 | in emacsclient. Good idea. (Alas, implementing this is not | 453 | in emacsclient. Good idea. (Alas, implementing this is not |
| @@ -449,9 +467,6 @@ THINGS TO DO | |||
| 449 | terminals in xterm and konsole. The screen does flicker a bit, | 467 | terminals in xterm and konsole. The screen does flicker a bit, |
| 450 | but it's so quick it isn't noticable. | 468 | but it's so quick it isn't noticable. |
| 451 | 469 | ||
| 452 | ** Clean up the frame-local variable system. I think it's ugly and | ||
| 453 | error-prone. But maybe I just haven't yet fully understood it. | ||
| 454 | |||
| 455 | ** Move baud_rate to struct display. | 470 | ** Move baud_rate to struct display. |
| 456 | 471 | ||
| 457 | ** Implement support for starting an interactive Emacs session without | 472 | ** Implement support for starting an interactive Emacs session without |
| @@ -963,7 +978,7 @@ DIARY OF CHANGES | |||
| 963 | 978 | ||
| 964 | (Fixed. Emacs now uses the locale settings as seen by the | 979 | (Fixed. Emacs now uses the locale settings as seen by the |
| 965 | emacsclient process for server tty frames.) | 980 | emacsclient process for server tty frames.) |
| 966 | 981 | (Update: Not really; Vlocale_coding_system is still global.) | |
| 967 | 982 | ||
| 968 | -- Make `struct display' accessible to Lisp programs. Accessor functions: | 983 | -- Make `struct display' accessible to Lisp programs. Accessor functions: |
| 969 | 984 | ||
| @@ -1022,5 +1037,9 @@ DIARY OF CHANGES | |||
| 1022 | 1037 | ||
| 1023 | (Done. This is the new default. No complaints so far.) | 1038 | (Done. This is the new default. No complaints so far.) |
| 1024 | 1039 | ||
| 1040 | -- Clean up the frame-local variable system. I think it's ugly and | ||
| 1041 | error-prone. But maybe I just haven't yet fully understood it. | ||
| 1042 | |||
| 1043 | (Nothing to do. It doesn't seem ugly any more. It's rather clever.) | ||
| 1025 | 1044 | ||
| 1026 | ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d | 1045 | ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d |
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index a91c12bcaf2..8af768f91cc 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el | |||
| @@ -2470,11 +2470,14 @@ See also `locale-charset-language-names', `locale-language-names', | |||
| 2470 | ;; Set the `keyboard-coding-system' if appropriate (tty | 2470 | ;; Set the `keyboard-coding-system' if appropriate (tty |
| 2471 | ;; only). At least X and MS Windows can generate | 2471 | ;; only). At least X and MS Windows can generate |
| 2472 | ;; multilingual input. | 2472 | ;; multilingual input. |
| 2473 | (unless window-system | 2473 | ;; XXX This was disabled unless `window-system', but that |
| 2474 | (let ((kcs (or coding-system | 2474 | ;; leads to buggy behaviour when a tty frame is opened |
| 2475 | (car (get-language-info language-name | 2475 | ;; later. Setting the keyboard coding system has no adverse |
| 2476 | 'coding-system))))) | 2476 | ;; effect on X, so let's do it anyway. -- Lorentey |
| 2477 | (if kcs (set-keyboard-coding-system kcs)))) | 2477 | (let ((kcs (or coding-system |
| 2478 | (car (get-language-info language-name | ||
| 2479 | 'coding-system))))) | ||
| 2480 | (if kcs (set-keyboard-coding-system kcs))) | ||
| 2478 | 2481 | ||
| 2479 | (setq locale-coding-system | 2482 | (setq locale-coding-system |
| 2480 | (car (get-language-info language-name 'coding-priority)))) | 2483 | (car (get-language-info language-name 'coding-priority)))) |
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 49635652bb2..d86ce458bf4 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -1199,13 +1199,17 @@ see) to CODING-SYSTEM." | |||
| 1199 | This is normally set according to the selected language environment. | 1199 | This is normally set according to the selected language environment. |
| 1200 | See also the command `set-terminal-coding-system'.") | 1200 | See also the command `set-terminal-coding-system'.") |
| 1201 | 1201 | ||
| 1202 | (defun set-terminal-coding-system (coding-system) | 1202 | (defun set-terminal-coding-system (coding-system &optional display) |
| 1203 | "Set coding system of your terminal to CODING-SYSTEM. | 1203 | "Set coding system of terminal output to CODING-SYSTEM. |
| 1204 | All text output to the terminal will be encoded | 1204 | All text output to DISPLAY will be encoded |
| 1205 | with the specified coding system. | 1205 | with the specified coding system. |
| 1206 | |||
| 1206 | For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems]. | 1207 | For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems]. |
| 1207 | The default is determined by the selected language environment | 1208 | The default is determined by the selected language environment |
| 1208 | or by the previous use of this command." | 1209 | or by the previous use of this command. |
| 1210 | |||
| 1211 | DISPLAY may be a display id, a frame, or nil for the selected frame's display. | ||
| 1212 | The setting has no effect on graphical displays." | ||
| 1209 | (interactive | 1213 | (interactive |
| 1210 | (list (let ((default (if (and (not (terminal-coding-system)) | 1214 | (list (let ((default (if (and (not (terminal-coding-system)) |
| 1211 | default-terminal-coding-system) | 1215 | default-terminal-coding-system) |
| @@ -1219,7 +1223,7 @@ or by the previous use of this command." | |||
| 1219 | (setq coding-system default-terminal-coding-system)) | 1223 | (setq coding-system default-terminal-coding-system)) |
| 1220 | (if coding-system | 1224 | (if coding-system |
| 1221 | (setq default-terminal-coding-system coding-system)) | 1225 | (setq default-terminal-coding-system coding-system)) |
| 1222 | (set-terminal-coding-system-internal coding-system) | 1226 | (set-terminal-coding-system-internal coding-system display) |
| 1223 | (redraw-frame (selected-frame))) | 1227 | (redraw-frame (selected-frame))) |
| 1224 | 1228 | ||
| 1225 | (defvar default-keyboard-coding-system nil | 1229 | (defvar default-keyboard-coding-system nil |
| @@ -1227,14 +1231,18 @@ or by the previous use of this command." | |||
| 1227 | This is normally set according to the selected language environment. | 1231 | This is normally set according to the selected language environment. |
| 1228 | See also the command `set-keyboard-coding-system'.") | 1232 | See also the command `set-keyboard-coding-system'.") |
| 1229 | 1233 | ||
| 1230 | (defun set-keyboard-coding-system (coding-system) | 1234 | (defun set-keyboard-coding-system (coding-system &optional display) |
| 1231 | "Set coding system for keyboard input to CODING-SYSTEM. | 1235 | "Set coding system for keyboard input on DISPLAY to CODING-SYSTEM. |
| 1232 | In addition, this command enables Encoded-kbd minor mode. | 1236 | In addition, this command enables Encoded-kbd minor mode. |
| 1233 | \(If CODING-SYSTEM is nil, Encoded-kbd mode is turned off -- see | 1237 | \(If CODING-SYSTEM is nil, Encoded-kbd mode is turned off -- see |
| 1234 | `encoded-kbd-mode'.) | 1238 | `encoded-kbd-mode'.) |
| 1239 | |||
| 1235 | For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems]. | 1240 | For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems]. |
| 1236 | The default is determined by the selected language environment | 1241 | The default is determined by the selected language environment |
| 1237 | or by the previous use of this command." | 1242 | or by the previous use of this command. |
| 1243 | |||
| 1244 | DISPLAY may be a display id, a frame, or nil for the selected frame's display. | ||
| 1245 | The setting has no effect on graphical displays." | ||
| 1238 | (interactive | 1246 | (interactive |
| 1239 | (list (let ((default (if (and (not (keyboard-coding-system)) | 1247 | (list (let ((default (if (and (not (keyboard-coding-system)) |
| 1240 | default-keyboard-coding-system) | 1248 | default-keyboard-coding-system) |
| @@ -1248,7 +1256,7 @@ or by the previous use of this command." | |||
| 1248 | (setq coding-system default-keyboard-coding-system)) | 1256 | (setq coding-system default-keyboard-coding-system)) |
| 1249 | (if coding-system | 1257 | (if coding-system |
| 1250 | (setq default-keyboard-coding-system coding-system)) | 1258 | (setq default-keyboard-coding-system coding-system)) |
| 1251 | (set-keyboard-coding-system-internal coding-system) | 1259 | (set-keyboard-coding-system-internal coding-system display) |
| 1252 | (setq keyboard-coding-system coding-system) | 1260 | (setq keyboard-coding-system coding-system) |
| 1253 | (encoded-kbd-mode (if coding-system 1 0))) | 1261 | (encoded-kbd-mode (if coding-system 1 0))) |
| 1254 | 1262 | ||
diff --git a/lisp/term/lk201.el b/lisp/term/lk201.el index 1f8d9ca77a3..b207e13b0a5 100644 --- a/lisp/term/lk201.el +++ b/lisp/term/lk201.el | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | ;; -*- no-byte-compile: t -*- | 1 | ;; -*- no-byte-compile: t -*- |
| 2 | ;; Define function key sequences for DEC terminals. | 2 | ;; Define function key sequences for DEC terminals. |
| 3 | 3 | ||
| 4 | ;; XXX We need to find a way to have these define-keys be display-local. -- Lorentey | ||
| 5 | |||
| 4 | ;; Termcap or terminfo should set these. | 6 | ;; Termcap or terminfo should set these. |
| 5 | ;; (define-key function-key-map "\e[A" [up]) | 7 | ;; (define-key function-key-map "\e[A" [up]) |
| 6 | ;; (define-key function-key-map "\e[B" [down]) | 8 | ;; (define-key function-key-map "\e[B" [down]) |
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 | ||