From: Karoly Lorentey Date: Sat, 29 Jul 2006 09:59:12 +0000 (+0000) Subject: Merged from emacs@sv.gnu.org X-Git-Tag: emacs-pretest-23.0.90~11236^2~141^2~32 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=251bc578cc636223d618d06cf2a2bb7d07db9cce;p=emacs.git Merged from emacs@sv.gnu.org Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-351 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-352 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-353 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-354 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-355 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-356 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-357 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-358 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-359 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-360 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-361 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-362 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-363 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-364 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-365 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-366 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-367 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-368 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-369 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-370 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-115 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-116 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-117 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-118 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-119 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-120 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-573 --- 251bc578cc636223d618d06cf2a2bb7d07db9cce diff --cc lisp/term/xterm.el index becf418e4e0,7622f23752b..79324306ad1 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@@ -27,173 -27,6 +27,181 @@@ ;;; Code: +(defvar xterm-function-map (make-sparse-keymap) + "Function key map overrides for xterm.") + +;; xterm from X.org 6.8.2 uses these key definitions. +(define-key xterm-function-map "\eOP" [f1]) +(define-key xterm-function-map "\eOQ" [f2]) +(define-key xterm-function-map "\eOR" [f3]) +(define-key xterm-function-map "\eOS" [f4]) +(define-key xterm-function-map "\e[15~" [f5]) +(define-key xterm-function-map "\e[17~" [f6]) +(define-key xterm-function-map "\e[18~" [f7]) +(define-key xterm-function-map "\e[19~" [f8]) +(define-key xterm-function-map "\e[20~" [f9]) +(define-key xterm-function-map "\e[21~" [f10]) +(define-key xterm-function-map "\e[23~" [f11]) +(define-key xterm-function-map "\e[24~" [f12]) + +(define-key xterm-function-map "\eO2P" [S-f1]) +(define-key xterm-function-map "\eO2Q" [S-f2]) +(define-key xterm-function-map "\eO2R" [S-f3]) +(define-key xterm-function-map "\eO2S" [S-f4]) +(define-key xterm-function-map "\e[15;2~" [S-f5]) +(define-key xterm-function-map "\e[17;2~" [S-f6]) +(define-key xterm-function-map "\e[18;2~" [S-f7]) +(define-key xterm-function-map "\e[19;2~" [S-f8]) +(define-key xterm-function-map "\e[20;2~" [S-f9]) +(define-key xterm-function-map "\e[21;2~" [S-f10]) +(define-key xterm-function-map "\e[23;2~" [S-f11]) +(define-key xterm-function-map "\e[24;2~" [S-f12]) + +(define-key xterm-function-map "\eO5P" [C-f1]) +(define-key xterm-function-map "\eO5Q" [C-f2]) +(define-key xterm-function-map "\eO5R" [C-f3]) +(define-key xterm-function-map "\eO5S" [C-f4]) +(define-key xterm-function-map "\e[15;5~" [C-f5]) +(define-key xterm-function-map "\e[17;5~" [C-f6]) +(define-key xterm-function-map "\e[18;5~" [C-f7]) +(define-key xterm-function-map "\e[19;5~" [C-f8]) +(define-key xterm-function-map "\e[20;5~" [C-f9]) +(define-key xterm-function-map "\e[21;5~" [C-f10]) +(define-key xterm-function-map "\e[23;5~" [C-f11]) +(define-key xterm-function-map "\e[24;5~" [C-f12]) + +(define-key xterm-function-map "\eO6P" [C-S-f1]) +(define-key xterm-function-map "\eO6Q" [C-S-f2]) +(define-key xterm-function-map "\eO6R" [C-S-f3]) +(define-key xterm-function-map "\eO6S" [C-S-f4]) +(define-key xterm-function-map "\e[15;6~" [C-S-f5]) +(define-key xterm-function-map "\e[17;6~" [C-S-f6]) +(define-key xterm-function-map "\e[18;6~" [C-S-f7]) +(define-key xterm-function-map "\e[19;6~" [C-S-f8]) +(define-key xterm-function-map "\e[20;6~" [C-S-f9]) +(define-key xterm-function-map "\e[21;6~" [C-S-f10]) +(define-key xterm-function-map "\e[23;6~" [C-S-f11]) +(define-key xterm-function-map "\e[24;6~" [C-S-f12]) + +(define-key xterm-function-map "\eO3P" [A-f1]) +(define-key xterm-function-map "\eO3Q" [A-f2]) +(define-key xterm-function-map "\eO3R" [A-f3]) +(define-key xterm-function-map "\eO3S" [A-f4]) +(define-key xterm-function-map "\e[15;3~" [A-f5]) +(define-key xterm-function-map "\e[17;3~" [A-f6]) +(define-key xterm-function-map "\e[18;3~" [A-f7]) +(define-key xterm-function-map "\e[19;3~" [A-f8]) +(define-key xterm-function-map "\e[20;3~" [A-f9]) +(define-key xterm-function-map "\e[21;3~" [A-f10]) +(define-key xterm-function-map "\e[23;3~" [A-f11]) +(define-key xterm-function-map "\e[24;3~" [A-f12]) + +(define-key xterm-function-map "\eOA" [up]) +(define-key xterm-function-map "\eOB" [down]) +(define-key xterm-function-map "\eOC" [right]) +(define-key xterm-function-map "\eOD" [left]) +(define-key xterm-function-map "\eOF" [end]) +(define-key xterm-function-map "\eOH" [home]) + +(define-key xterm-function-map "\e[1;2A" [S-up]) +(define-key xterm-function-map "\e[1;2B" [S-down]) +(define-key xterm-function-map "\e[1;2C" [S-right]) +(define-key xterm-function-map "\e[1;2D" [S-left]) +(define-key xterm-function-map "\e[1;2F" [S-end]) +(define-key xterm-function-map "\e[1;2H" [S-home]) + +(define-key xterm-function-map "\e[1;5A" [C-up]) +(define-key xterm-function-map "\e[1;5B" [C-down]) +(define-key xterm-function-map "\e[1;5C" [C-right]) +(define-key xterm-function-map "\e[1;5D" [C-left]) +(define-key xterm-function-map "\e[1;5F" [C-end]) +(define-key xterm-function-map "\e[1;5H" [C-home]) + +(define-key xterm-function-map "\e[1;6A" [C-S-up]) +(define-key xterm-function-map "\e[1;6B" [C-S-down]) +(define-key xterm-function-map "\e[1;6C" [C-S-right]) +(define-key xterm-function-map "\e[1;6D" [C-S-left]) +(define-key xterm-function-map "\e[1;6F" [C-S-end]) +(define-key xterm-function-map "\e[1;6H" [C-S-home]) + +(define-key xterm-function-map "\e[1;3A" [A-up]) +(define-key xterm-function-map "\e[1;3B" [A-down]) +(define-key xterm-function-map "\e[1;3C" [A-right]) +(define-key xterm-function-map "\e[1;3D" [A-left]) +(define-key xterm-function-map "\e[1;3F" [A-end]) +(define-key xterm-function-map "\e[1;3H" [A-home]) + +(define-key xterm-function-map "\e[2~" [insert]) +(define-key xterm-function-map "\e[3~" [delete]) +(define-key xterm-function-map "\e[5~" [prior]) +(define-key xterm-function-map "\e[6~" [next]) + +(define-key xterm-function-map "\e[2;2~" [S-insert]) +(define-key xterm-function-map "\e[3;2~" [S-delete]) +(define-key xterm-function-map "\e[5;2~" [S-prior]) +(define-key xterm-function-map "\e[6;2~" [S-next]) + +(define-key xterm-function-map "\e[2;5~" [C-insert]) +(define-key xterm-function-map "\e[3;5~" [C-delete]) +(define-key xterm-function-map "\e[5;5~" [C-prior]) +(define-key xterm-function-map "\e[6;5~" [C-next]) + +(define-key xterm-function-map "\e[2;6~" [C-S-insert]) +(define-key xterm-function-map "\e[3;6~" [C-S-delete]) +(define-key xterm-function-map "\e[5;6~" [C-S-prior]) +(define-key xterm-function-map "\e[6;6~" [C-S-next]) + +(define-key xterm-function-map "\e[2;3~" [A-insert]) +(define-key xterm-function-map "\e[3;3~" [A-delete]) +(define-key xterm-function-map "\e[5;3~" [A-prior]) +(define-key xterm-function-map "\e[6;3~" [A-next]) + +(define-key xterm-function-map "\e[4~" [select]) +(define-key xterm-function-map "\e[29~" [print]) + +;; These keys are available in xterm starting from version 214 - ;; if the modifyOtherKeys resource is set. - (define-key xterm-function-map "\e[27;5;9~" [(control ?\t)]) ++;; if the modifyOtherKeys resource is set to 1. ++(define-key xterm-function-map "\e[27;5;9~" [C-tab]) +(define-key xterm-function-map "\e[27;5;13~" [C-return]) - (define-key xterm-function-map "\e[27;5;44~" [(control ?\,)]) - (define-key xterm-function-map "\e[27;5;46~" [(control ?\.)]) - (define-key xterm-function-map "\e[27;5;47~" [(control ?\/)]) - (define-key xterm-function-map "\e[27;5;92~" [(control ?\\)]) ++(define-key xterm-function-map "\e[27;5;44~" [?\C-,]) ++(define-key xterm-function-map "\e[27;5;46~" [?\C-.]) ++(define-key xterm-function-map "\e[27;5;47~" [?\C-/]) ++(define-key xterm-function-map "\e[27;5;92~" [?\C-\\)]) ++ ++(define-key xterm-function-map "\e[27;2;9~" [S-tab]) ++(define-key xterm-function-map "\e[27;2;13~" [S-return]) ++ ++(define-key xterm-function-map "\e[27;6;9~" [(C-S-tab)]) ++ ++(define-key xterm-function-map "\e[27;13;46~" [?\C-\M-.]) ++ + +;; Other versions of xterm might emit these. +(define-key xterm-function-map "\e[A" [up]) +(define-key xterm-function-map "\e[B" [down]) +(define-key xterm-function-map "\e[C" [right]) +(define-key xterm-function-map "\e[D" [left]) +(define-key xterm-function-map "\e[1~" [home]) + +(define-key xterm-function-map "\e[1;2A" [S-up]) +(define-key xterm-function-map "\e[1;2B" [S-down]) +(define-key xterm-function-map "\e[1;2C" [S-right]) +(define-key xterm-function-map "\e[1;2D" [S-left]) +(define-key xterm-function-map "\e[1;2F" [S-end]) +(define-key xterm-function-map "\e[1;2H" [S-home]) + +(define-key xterm-function-map "\e[1;5A" [C-up]) +(define-key xterm-function-map "\e[1;5B" [C-down]) +(define-key xterm-function-map "\e[1;5C" [C-right]) +(define-key xterm-function-map "\e[1;5D" [C-left]) +(define-key xterm-function-map "\e[1;5F" [C-end]) +(define-key xterm-function-map "\e[1;5H" [C-home]) + +(define-key xterm-function-map "\e[11~" [f1]) +(define-key xterm-function-map "\e[12~" [f2]) +(define-key xterm-function-map "\e[13~" [f3]) +(define-key xterm-function-map "\e[14~" [f4]) + (defun terminal-init-xterm () "Terminal initialization function for xterm." ;; rxvt terminals sometimes set the TERM variable to "xterm", but diff --cc src/fns.c index 69e12bf25ce,ca4a098878a..0054e6fc998 --- a/src/fns.c +++ b/src/fns.c @@@ -3250,9 -3249,7 +3250,8 @@@ is nil and `use-dialog-box' is non-nil Fraise_frame (mini_frame); } + temporarily_switch_to_single_kboard (SELECTED_FRAME ()); - obj = read_filtered_event (1, 0, 0, 0); - + obj = read_filtered_event (1, 0, 0, 0, Qnil); cursor_in_echo_area = 0; /* If we need to quit, quit with cursor_in_echo_area = 0. */ QUIT; diff --cc src/keyboard.c index 025c8a3f85c,23e10aefac1..08b352c3c3a --- a/src/keyboard.c +++ b/src/keyboard.c @@@ -1164,76 -1165,6 +1165,77 @@@ pop_kboard ( xfree (p); #endif } + +/* Switch to single_kboard mode, making current_kboard the only KBOARD + from which further input is accepted. If F is non-nil, set its + KBOARD as the current keyboard. + + This function uses record_unwind_protect to return to the previous + state later. + + If Emacs is already in single_kboard mode, and F's keyboard is + locked, then this function will throw an errow. */ + +void +temporarily_switch_to_single_kboard (f) + struct frame *f; +{ +#ifdef MULTI_KBOARD + int was_locked = single_kboard; + if (was_locked) + { + if (f != NULL && FRAME_KBOARD (f) != current_kboard) + /* We can not switch keyboards while in single_kboard mode. - This can legally happen when Lisp code calls - `recursive-edit' (or `read-minibuffer' or `y-or-n-p') after - it switched to a locked frame. This kind of situation is - likely to happen when server.el connects to a new - terminal. */ ++ In rare cases, Lisp code may call `recursive-edit' (or ++ `read-minibuffer' or `y-or-n-p') after it switched to a ++ locked frame. For example, this is likely to happen ++ when server.el connects to a new terminal while Emacs is in ++ single_kboard mode. It is best to throw an error instead ++ of presenting the user with a frozen screen. */ + error ("Terminal %d is locked, cannot read from it", + FRAME_TERMINAL (f)->id); + else + /* This call is unnecessary, but helps + `restore_kboard_configuration' discover if somebody changed + `current_kboard' behind our back. */ + push_kboard (current_kboard); + } + else if (f != NULL) + current_kboard = FRAME_KBOARD (f); + single_kboard = 1; + record_unwind_protect (restore_kboard_configuration, + (was_locked ? Qt : Qnil)); +#endif +} + +#if 0 /* This function is not needed anymore. */ +void +record_single_kboard_state () +{ + if (single_kboard) + push_kboard (current_kboard); + record_unwind_protect (restore_kboard_configuration, + (single_kboard ? Qt : Qnil)); +} +#endif + +static Lisp_Object +restore_kboard_configuration (was_locked) + Lisp_Object was_locked; +{ + if (NILP (was_locked)) + single_kboard = 0; + else + { + struct kboard *prev = current_kboard; + single_kboard = 1; + pop_kboard (); + /* The pop should not change the kboard. */ + if (single_kboard && current_kboard != prev) + abort (); + } + return Qnil; +} /* Handle errors that are not handled at inner levels by printing an error message and returning to the editor command loop. */ @@@ -1304,23 -1233,35 +1306,31 @@@ cmd_error_internal (data, context Lisp_Object data; char *context; { - Lisp_Object stream; - int kill_emacs_p = 0; struct frame *sf = SELECTED_FRAME (); + /* The immediate context is not interesting for Quits, + since they are asyncronous. */ + if (EQ (XCAR (data), Qquit)) + Vsignaling_function = Qnil; + Vquit_flag = Qnil; Vinhibit_quit = Qt; - clear_message (1, 0); + /* Use user's specified output function if any. */ + if (!NILP (Vcommand_error_function)) + call3 (Vcommand_error_function, data, + build_string (context ? context : ""), + Vsignaling_function); /* If the window system or terminal frame hasn't been initialized - yet, or we're not interactive, it's best to dump this message out - to stderr and exit. */ - if (!sf->glyphs_initialized_p - || FRAME_INITIAL_P (sf) - || noninteractive) - { - stream = Qexternal_debugging_output; - kill_emacs_p = 1; + yet, or we're not interactive, write the message to stderr and exit. */ + else if (!sf->glyphs_initialized_p - /* This is the case of the frame dumped with Emacs, when we're - running under a window system. */ - || (!NILP (Vwindow_system) - && !inhibit_window_system - && FRAME_TERMCAP_P (sf)) ++ || FRAME_INITIAL_P (sf) + || noninteractive) + { + print_error_message (data, Qexternal_debugging_output, + context, Vsignaling_function); + Fterpri (Qexternal_debugging_output); + Fkill_emacs (make_number (-1)); } else { @@@ -2467,9 -2385,10 +2464,13 @@@ do { if (polling_stopped_here) start_po if we used a mouse menu to read the input, or zero otherwise. If USED_MOUSE_MENU is null, we don't dereference it. + Value is -2 when we find input on another keyboard. A second call + to read_char will read it. + + If END_TIME is non-null, it is a pointer to an EMACS_TIME + specifying the maximum time to wait until. If no input arrives by + that time, stop waiting and return nil. + Value is t if we showed a menu and the user rejected it. */ Lisp_Object @@@ -9015,28 -8849,8 +9038,28 @@@ read_key_sequence (keybuf, bufsize, pro #ifdef MULTI_KBOARD KBOARD *interrupted_kboard = current_kboard; struct frame *interrupted_frame = SELECTED_FRAME (); - if (setjmp (wrong_kboard_jmpbuf)) +#endif + key = read_char (NILP (prompt), nmaps, + (Lisp_Object *) submaps, last_nonmenu_event, - &used_mouse_menu); ++ &used_mouse_menu, NULL); +#ifdef MULTI_KBOARD + if (INTEGERP (key) && XINT (key) == -2) /* wrong_kboard_jmpbuf */ { + int found = 0; + struct kboard *k; + + for (k = all_kboards; k; k = k->next_kboard) + if (k == interrupted_kboard) + found = 1; + + if (!found) + { + /* Don't touch interrupted_kboard when it's been + deleted. */ + delayed_switch_frame = Qnil; + goto replay_sequence; + } + if (!NILP (delayed_switch_frame)) { interrupted_kboard->kbd_queue diff --cc src/keyboard.h index a3fa54b1042,96ac7d2e856..8f1c5dd31a9 --- a/src/keyboard.h +++ b/src/keyboard.h @@@ -19,11 -19,12 +19,13 @@@ along with GNU Emacs; see the file COPY the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + #include "systime.h" /* for EMACS_TIME */ + /* Length of echobuf field in each KBOARD. */ -/* Each KBOARD represents one logical input stream from which Emacs gets input. - If we are using an ordinary terminal, it has one KBOARD object. +/* Each KBOARD represents one logical input stream from which Emacs + gets input. If we are using ordinary terminals, it has one KBOARD + object for each terminal device. Usually each X display screen has its own KBOARD, but when two of them are on the same X server, we assume they share a keyboard and give them one KBOARD in common. @@@ -305,12 -299,10 +307,15 @@@ struct input_event extern Lisp_Object parse_modifiers P_ ((Lisp_Object)); extern Lisp_Object reorder_modifiers P_ ((Lisp_Object)); + extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, + int *, EMACS_TIME *)); -/* User-supplied string to translate input characters through. */ -extern Lisp_Object Vkeyboard_translate_table; ++ + +/* Parent keymap of terminal-local function-key-map instances. */ +extern Lisp_Object Vfunction_key_map; + +/* Parent keymap of terminal-local key-translation-map instances. */ +extern Lisp_Object Vkey_translation_map; extern int parse_menu_item P_ ((Lisp_Object, int, int)); diff --cc src/lread.c index 91825bce152,8f82c13be6a..ef76e72f75f --- a/src/lread.c +++ b/src/lread.c @@@ -436,8 -437,8 +439,6 @@@ static void substitute_in_interval P_ ( /* Get a character from the tty. */ - extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *)); -extern Lisp_Object read_char (); -- /* Read input events until we get one that's acceptable for our purposes. If NO_SWITCH_FRAME is non-zero, switch-frame events are stashed @@@ -470,11 -476,24 +476,26 @@@ read_filtered_event (no_switch_frame, a delayed_switch_frame = Qnil; - /* Read until we get an acceptable event. */ + /* Compute timeout. */ + if (NUMBERP (seconds)) + { + EMACS_TIME wait_time; + int sec, usec; - double duration = extract_float (seconds); ++ double duration = extract_float (seconds); + + sec = (int) duration; + usec = (duration - sec) * 1000000; + EMACS_GET_TIME (end_time); + EMACS_SET_SECS_USECS (wait_time, sec, usec); + EMACS_ADD_TIME (end_time, end_time, wait_time); + } + - /* Read until we get an acceptable event. */ ++/* Read until we get an acceptable event. */ retry: - val = read_char (0, 0, 0, (input_method ? Qnil : Qt), 0, - NUMBERP (seconds) ? &end_time : NULL); + do - val = read_char (0, 0, 0, (input_method ? Qnil : Qt), 0); ++ val = read_char (0, 0, 0, (input_method ? Qnil : Qt), 0, ++ NUMBERP (seconds) ? &end_time : NULL); + while (INTEGERP (val) && XINT (val) == -2); /* wrong_kboard_jmpbuf */ if (BUFFERP (val)) goto retry; diff --cc src/puresize.h index c1e4624564c,bae7cbb6d6a..d0ba0c4e57e --- a/src/puresize.h +++ b/src/puresize.h @@@ -43,7 -43,7 +43,7 @@@ Boston, MA 02110-1301, USA. * #endif #ifndef BASE_PURESIZE - #define BASE_PURESIZE (1240000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) -#define BASE_PURESIZE (1102000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) ++#define BASE_PURESIZE (1124000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) #endif /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ diff --cc src/xdisp.c index 092c5d7c520,22be60f7eb8..76ab430386c --- a/src/xdisp.c +++ b/src/xdisp.c @@@ -16552,9 -16552,10 +16564,10 @@@ display_mode_line (w, face_id, format /* Temporarily make frame's keyboard the current kboard so that kboard-local variables in the mode_line_format will get the right values. */ - push_frame_kboard (it.f); + push_kboard (FRAME_KBOARD (it.f)); + record_unwind_save_match_data (); display_mode_element (&it, 0, 0, 0, format, Qnil, 0); - pop_frame_kboard (); + pop_kboard (); unbind_to (count, Qnil);