Update: selecting a region with the mouse enables single_kboard
under X. This is very confusing.
- Update: After discussions with Richard, this will be resolved by
- having locked displays warn the user to wait, and introducing a
- complex protocol to remotely bail out of single-kboard mode by
- pressing C-g.
+ Update: After discussions with Richard Stallman, this will be
+ resolved by having locked displays warn the user to wait, and
+ introducing a complex protocol to remotely bail out of
+ single-kboard mode by pressing C-g.
Update: Warning the user is not trivial to implement, as Emacs has
- only one echo area. Ideally the warning should not be displayed on
- the display that is locking the others. Perhaps the high
- probability of user confusion caused by single_kboard mode deserves
- a special case in the display code. Alternatively, it might be
- good enough to signal single_kboard mode by changing the modelines
- or some other frame-local display element on the locked out displays.
+ only one echo area, shared by all frames. Ideally the warning
+ should not be displayed on the display that is locking the others.
+ Perhaps the high probability of user confusion caused by
+ single_kboard mode deserves a special case in the display code.
+ Alternatively, it might be good enough to signal single_kboard mode
+ by changing the modelines or some other frame-local display element
+ on the locked out displays.
** normal-erase-is-backspace-mode in simple.el needs to be updated for
multi-tty (rep. by Dan Waber).
** rif->flush_display_optional (NULL) calls should be replaced by a
new global function.
+** Support multiple character locales.
+
+ (1) A version of `set-locale-environment' needs to be written
+ for setting up display-local settings on ttys. I think
+ calling set-display-table-and-terminal-coding-system and
+ set-keyboard-coding-system would be enough. The language
+ environment itself should remain a global setting.
+
+ (2) Have a look at Vlocale_coding_system. Seems like it would
+ be a tedious job to localize it, although most references
+ use it for interfacing with libc and are therefore OK with
+ the global definition.
+
+ Exceptions found so far: x-select-text and
+ x-cut-buffer-or-selection-value.
+
** Have a look at fatal_error_hook.
** Have a look at set_frame_matrix_frame.
** The terminal customization files in term/*.el tend to change global
parameters, which may confuse Emacs with multiple displays. Change
- them to tweak only frame-local settings, if possible.
+ them to tweak only frame-local settings, if possible. (They tend
+ to call define-key to set function key sequences a lot.)
** Dan Nicolaescu suggests that -nw should be added as an alias for -t
in emacsclient. Good idea. (Alas, implementing this is not
terminals in xterm and konsole. The screen does flicker a bit,
but it's so quick it isn't noticable.
-** Clean up the frame-local variable system. I think it's ugly and
- error-prone. But maybe I just haven't yet fully understood it.
-
** Move baud_rate to struct display.
** Implement support for starting an interactive Emacs session without
(Fixed. Emacs now uses the locale settings as seen by the
emacsclient process for server tty frames.)
-
+ (Update: Not really; Vlocale_coding_system is still global.)
-- Make `struct display' accessible to Lisp programs. Accessor functions:
(Done. This is the new default. No complaints so far.)
+-- Clean up the frame-local variable system. I think it's ugly and
+ error-prone. But maybe I just haven't yet fully understood it.
+
+ (Nothing to do. It doesn't seem ugly any more. It's rather clever.)
;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d
;; Set the `keyboard-coding-system' if appropriate (tty
;; only). At least X and MS Windows can generate
;; multilingual input.
- (unless window-system
- (let ((kcs (or coding-system
- (car (get-language-info language-name
- 'coding-system)))))
- (if kcs (set-keyboard-coding-system kcs))))
+ ;; XXX This was disabled unless `window-system', but that
+ ;; leads to buggy behaviour when a tty frame is opened
+ ;; later. Setting the keyboard coding system has no adverse
+ ;; effect on X, so let's do it anyway. -- Lorentey
+ (let ((kcs (or coding-system
+ (car (get-language-info language-name
+ 'coding-system)))))
+ (if kcs (set-keyboard-coding-system kcs)))
(setq locale-coding-system
(car (get-language-info language-name 'coding-priority))))
This is normally set according to the selected language environment.
See also the command `set-terminal-coding-system'.")
-(defun set-terminal-coding-system (coding-system)
- "Set coding system of your terminal to CODING-SYSTEM.
-All text output to the terminal will be encoded
+(defun set-terminal-coding-system (coding-system &optional display)
+ "Set coding system of terminal output to CODING-SYSTEM.
+All text output to DISPLAY will be encoded
with 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."
+or by the previous use of this command.
+
+DISPLAY may be a display id, a frame, or nil for the selected frame's display.
+The setting has no effect on graphical displays."
(interactive
(list (let ((default (if (and (not (terminal-coding-system))
default-terminal-coding-system)
(setq coding-system default-terminal-coding-system))
(if coding-system
(setq default-terminal-coding-system coding-system))
- (set-terminal-coding-system-internal coding-system)
+ (set-terminal-coding-system-internal coding-system display)
(redraw-frame (selected-frame)))
(defvar default-keyboard-coding-system nil
This is normally set according to the selected language environment.
See also the command `set-keyboard-coding-system'.")
-(defun set-keyboard-coding-system (coding-system)
- "Set coding system for keyboard input to CODING-SYSTEM.
+(defun set-keyboard-coding-system (coding-system &optional display)
+ "Set coding system for keyboard input on DISPLAY to CODING-SYSTEM.
In addition, this command enables Encoded-kbd minor mode.
\(If CODING-SYSTEM is nil, Encoded-kbd mode is turned off -- see
`encoded-kbd-mode'.)
+
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."
+or by the previous use of this command.
+
+DISPLAY may be a display id, a frame, or nil for the selected frame's display.
+The setting has no effect on graphical displays."
(interactive
(list (let ((default (if (and (not (keyboard-coding-system))
default-keyboard-coding-system)
(setq coding-system default-keyboard-coding-system))
(if coding-system
(setq default-keyboard-coding-system coding-system))
- (set-keyboard-coding-system-internal coding-system)
+ (set-keyboard-coding-system-internal coding-system display)
(setq keyboard-coding-system coding-system)
(encoded-kbd-mode (if coding-system 1 0)))
;; -*- no-byte-compile: t -*-
;; Define function key sequences for DEC terminals.
+;; XXX We need to find a way to have these define-keys be display-local. -- Lorentey
+
;; Termcap or terminfo should set these.
;; (define-key function-key-map "\e[A" [up])
;; (define-key function-key-map "\e[B" [down])
}
\f
DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_internal,
- Sset_terminal_coding_system_internal, 1, 1, 0,
+ Sset_terminal_coding_system_internal, 1, 2, 0,
doc: /* Internal use only. */)
- (coding_system)
+ (coding_system, display)
Lisp_Object coding_system;
+ Lisp_Object display;
{
- struct coding_system *terminal_coding = FRAME_TERMINAL_CODING (SELECTED_FRAME ());
+ struct coding_system *terminal_coding = DISPLAY_TERMINAL_CODING (get_display (display, 1));
CHECK_SYMBOL (coding_system);
setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding);
/* We had better not send unsafe characters to terminal. */
}
DEFUN ("terminal-coding-system", Fterminal_coding_system,
- Sterminal_coding_system, 0, 0, 0,
- doc: /* Return coding system specified for terminal output. */)
- ()
+ Sterminal_coding_system, 0, 1, 0,
+ doc: /* Return coding system specified for terminal output on the given display.
+DISPLAY may be a display id, a frame, or nil for the selected frame's display. */)
+ (display)
+ Lisp_Object display;
{
- return FRAME_TERMINAL_CODING (SELECTED_FRAME ())->symbol;
+ return DISPLAY_TERMINAL_CODING (get_display (display, 1))->symbol;
}
DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_internal,
- Sset_keyboard_coding_system_internal, 1, 1, 0,
+ Sset_keyboard_coding_system_internal, 1, 2, 0,
doc: /* Internal use only. */)
- (coding_system)
+ (coding_system, display)
Lisp_Object coding_system;
+ Lisp_Object display;
{
+ struct display *d = get_display (display, 1);
CHECK_SYMBOL (coding_system);
+
setup_coding_system (Fcheck_coding_system (coding_system),
- FRAME_KEYBOARD_CODING (SELECTED_FRAME ()));
+ DISPLAY_KEYBOARD_CODING (d));
/* Character composition should be disabled. */
- FRAME_KEYBOARD_CODING (SELECTED_FRAME ())->composing = COMPOSITION_DISABLED;
+ DISPLAY_KEYBOARD_CODING (d)->composing = COMPOSITION_DISABLED;
return Qnil;
}
DEFUN ("keyboard-coding-system", Fkeyboard_coding_system,
- Skeyboard_coding_system, 0, 0, 0,
+ Skeyboard_coding_system, 0, 1, 0,
doc: /* Return coding system specified for decoding keyboard input. */)
- ()
+ (display)
+ Lisp_Object display;
{
- return FRAME_KEYBOARD_CODING (SELECTED_FRAME ())->symbol;
+ return DISPLAY_KEYBOARD_CODING (get_display (display, 1))->symbol;
}
\f
extern void calculate_costs P_ ((struct frame *));
extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object));
extern void tty_setup_colors P_ ((struct tty_display_info *, int));
-extern struct display *get_display P_ ((Lisp_Object display));
+extern struct display *get_display P_ ((Lisp_Object display, int));
extern struct display *get_named_tty_display P_ ((char *));
EXFUN (Fdisplay_tty_type, 1);
extern struct display *init_initial_display P_ ((void));
{
display_device = XCDR (display_device);
CHECK_NUMBER (display_device);
- d = get_display (XINT (display_device));
- if (!d)
- wrong_type_argument (Qdisplay_live_p, display_device);
+ d = get_display (XINT (display_device), 1);
}
}
CHECK_LIVE_FRAME (frame);
- d = get_display (frame);
+ d = get_display (frame, 0);
if (!d)
return Qnil;
/* Return the display object specified by DISPLAY. DISPLAY may be a
display id, a frame, or nil for the display device of the current
- frame. */
+ frame. If THROW is zero, return NULL for failure, otherwise throw
+ an error. */
struct display *
-get_display (Lisp_Object display)
+get_display (Lisp_Object display, int throw)
{
+ Lisp_Object result = NULL;
+
if (NILP (display))
display = selected_frame;
- if (! INTEGERP (display) && ! FRAMEP (display))
- return NULL;
-
if (INTEGERP (display))
{
struct display *d;
for (d = display_list; d; d = d->next_display)
{
if (d->id == XINT (display))
- return d;
+ {
+ result = d;
+ break;
+ }
}
- return NULL;
}
else if (FRAMEP (display))
{
- return FRAME_DISPLAY (XFRAME (display));
+ result = FRAME_DISPLAY (XFRAME (display));
}
- return NULL;
+
+ if (result == NULL && throw)
+ wrong_type_argument (Qdisplay_live_p, display);
+
+ return result;
}
/* Return the tty display object specified by DISPLAY. */
static struct display *
get_tty_display (Lisp_Object display)
{
- struct display *d = get_display (display);
+ struct display *d = get_display (display, 0);
if (d && d->type == output_initial)
d = NULL;
(display)
Lisp_Object display;
{
- struct display *d = get_display (display);
-
- if (!d)
- wrong_type_argument (Qdisplay_live_p, display);
+ struct display *d = get_display (display, 1);
if (d->name)
return build_string (d->name);
(display)
Lisp_Object display;
{
- struct display *d = get_display (display);
+ struct display *d = get_display (display, 1);
- if (!d)
- wrong_type_argument (Qdisplay_live_p, display);
if (d->type != output_termcap)
error ("Display %d is not a termcap display", d->id);
(display)
Lisp_Object display;
{
- struct display *d = get_display (display);
-
- if (!d)
- wrong_type_argument (Qdisplay_live_p, display);
+ struct display *d = get_display (display, 1);
if (d->type != output_termcap || d->display_info.tty->name)
return Qnil;
{
struct display *d, *p;
- d = get_display (display);
+ d = get_display (display, 0);
if (!d)
return Qnil;
if (!INTEGERP (object))
return Qnil;
- d = get_display (object);
+ d = get_display (object, 0);
if (!d)
return Qnil;
#define FRAME_TERMINAL_CODING(f) ((f)->display->terminal_coding)
#define FRAME_KEYBOARD_CODING(f) ((f)->display->keyboard_coding)
+#define DISPLAY_TERMINAL_CODING(d) ((d)->terminal_coding)
+#define DISPLAY_KEYBOARD_CODING(d) ((d)->keyboard_coding)
+
#define FRAME_RIF(f) ((f)->display->rif)
#define FRAME_DISPLAY(f) ((f)->display)
}
else if (INTEGERP (frame))
{
- struct display *d = get_display (XINT (frame));
+ struct display *d = get_display (XINT (frame), 1);
- if (!d)
- wrong_type_argument (Qdisplay_live_p, frame);
if (d->type != output_x_window)
error ("Display %d is not an X display", XINT (frame));