X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/1a40d27fa251a6e805355d7f73093155b8e33057..28d3ed91adb431470f8ee9b84941779709df9b8b:/src/keyboard.c diff --git a/src/keyboard.c b/src/keyboard.c index 09305ff145..733a944ff3 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -943,6 +943,7 @@ command_loop_1 () if (! NILP (Vlucid_menu_bar_dirty_flag)) call0 (Qrecompute_lucid_menubar); +#if 0 /* This is done in xdisp.c now. */ #ifdef MULTI_FRAME for (tem = Vframe_list; CONSP (tem); tem = XCONS (tem)->cdr) { @@ -969,6 +970,7 @@ command_loop_1 () } } #endif /* MULTI_FRAME */ +#endif /* 0 */ /* Read next key sequence; i gets its length. */ i = read_key_sequence (keybuf, (sizeof keybuf / sizeof (keybuf[0])), 0); @@ -2088,17 +2090,26 @@ make_lispy_event (event) case ascii_keystroke: { int c = XFASTINT (event->code); - /* Include the bits for control and shift - only if the basic ASCII code can't indicate them. */ - if ((event->modifiers & ctrl_modifier) - && c >= 040) - c |= ctrl_modifier; - /* Set the shift modifier for a control char - made from a shifted letter. But only for letters! */ - if (XFASTINT (event->code) >= 'A' - 0100 - && XFASTINT (event->code) <= 'Z' - 0100 - && (event->modifiers & shift_modifier)) - c |= shift_modifier; + /* Turn ASCII characters into control characters + when proper. */ + if (event->modifiers & ctrl_modifier) + { + if (c >= 0100 && c < 0140) + { + int oc = c; + c &= ~0140; + /* Set the shift modifier for a control char + made from a shifted letter. But only for letters! */ + if (oc >= 'A' && oc <= 'Z') + c |= shift_modifier; + } + else if (c >= 'a' && c <= 'z') + c &= ~0140; + /* Include the bits for control and shift + only if the basic ASCII code can't indicate them. */ + else + c |= ctrl_modifier; + } c |= (event->modifiers & (meta_modifier | alt_modifier | hyper_modifier | super_modifier)); @@ -3382,7 +3393,9 @@ follow_key (key, nmaps, current, defs, next) lower-case letter, return the bindings for the lower-case letter. */ if (first_binding == nmaps && XTYPE (key) == Lisp_Int - && (UPPERCASEP (XINT (key) & 0x3ffff) + && ((((XINT (key) & 0x3ffff) + < XSTRING (current_buffer->downcase_table)->size) + && UPPERCASEP (XINT (key) & 0x3ffff)) || (XINT (key) & shift_modifier))) { if (XINT (key) & shift_modifier) @@ -3512,14 +3525,6 @@ read_key_sequence (keybuf, bufsize, prompt) if (NILP (Fkeymapp (Vfunction_key_map))) fkey_start = fkey_end = bufsize + 1; - /* We need to save the current buffer in case we switch buffers to - find the right binding for a mouse click. Note that we can't use - save_excursion_{save,restore} here, because they save point as - well as the current buffer; we don't want to save point, because - redisplay may change it, to accomodate a Fset_window_start or - something. */ - record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); - last_nonmenu_event = Qnil; if (INTERACTIVE) @@ -3690,6 +3695,18 @@ read_key_sequence (keybuf, bufsize, prompt) mock_input = t + 1; } + /* Arrange to go back to the original buffer once we're + done reading the key sequence. Note that we can't + use save_excursion_{save,restore} here, because they + save point as well as the current buffer; we don't + want to save point, because redisplay may change it, + to accomodate a Fset_window_start or something. We + don't want to do this at the top of the function, + because we may get input from a subprocess which + wants to change the selected window and stuff (say, + emacsclient). */ + record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); + set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); goto replay_sequence; } @@ -4479,7 +4496,8 @@ Second arg FLOW non-nil means use ^S/^Q flow control for output to terminal\n\ Third arg META t means accept 8-bit input (for a Meta key).\n\ META nil means ignore the top bit, on the assumption it is parity.\n\ Otherwise, accept 8-bit input and don't use the top bit for Meta.\n\ -Optional fourth arg QUIT if non-nil specifies character to use for quitting.") +Optional fourth arg QUIT if non-nil specifies character to use for quitting.\n\ +See also `current-input-mode'.") (interrupt, flow, meta, quit) Lisp_Object interrupt, flow, meta, quit; { @@ -4526,18 +4544,20 @@ The value is a list of the form (INTERRUPT FLOW META QUIT), where\n\ nil, Emacs is using CBREAK mode.\n\ FLOW is non-nil if Emacs uses ^S/^Q flow control for output to the\n\ terminal; this does not apply if Emacs uses interrupt-driven input.\n\ - META is non-nil if Emacs is accepting 8-bit input; otherwise, Emacs\n\ - clears the eighth bit of every input character.\n\ + META is t if accepting 8-bit input with 8th bit as Meta flag.\n\ + META nil means ignoring the top bit, on the assumption it is parity.\n\ + META is neither t nor nil if accepting 8-bit input and using\n\ + all 8 bits as the character code.\n\ QUIT is the character Emacs currently uses to quit.\n\ The elements of this list correspond to the arguments of\n\ -set-input-mode.") +`set-input-mode'.") () { Lisp_Object val[4]; val[0] = interrupt_input ? Qt : Qnil; val[1] = flow_control ? Qt : Qnil; - val[2] = meta_key ? Qt : Qnil; + val[2] = meta_key == 2 ? make_number (0) : meta_key == 1 ? Qt : Qnil; XSETINT (val[3], quit_char); return Flist (val, sizeof (val) / sizeof (val[0]));