From 48dfaa734be15e22f2a30a8cac73353e4649ce0a Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 18 Jul 2021 18:18:03 +0200 Subject: Clarify event-convert-list doc string * src/keyboard.c (Fevent_convert_list): Clarify that the base type returned isn't always the same (bug#7631). --- src/keyboard.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/keyboard.c') diff --git a/src/keyboard.c b/src/keyboard.c index 6174a4aad92..77d6bbba623 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -6622,8 +6622,11 @@ DEFUN ("event-convert-list", Fevent_convert_list, Sevent_convert_list, 1, 1, 0, EVENT-DESC should contain one base event type (a character or symbol) and zero or more modifier names (control, meta, hyper, super, shift, alt, drag, down, double or triple). The base must be last. -The return value is an event type (a character or symbol) which -has the same base event type and all the specified modifiers. */) + +The return value is an event type (a character or symbol) which has +essentially the same base event type and all the specified modifiers. +(Some compatibility base types, like symbols that represent a +character, are not returned verbatim.) */) (Lisp_Object event_desc) { Lisp_Object base = Qnil; -- cgit v1.2.1 From 7edbcb3648e9d08a4ccc291f672f831b4f07eb5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miha=20Rihtar=C5=A1i=C4=8D?= Date: Tue, 20 Jul 2021 14:36:45 +0200 Subject: Quit minibuffers without aborting kmacros * doc/lispref/commands.texi (Quitting): Document `minibuffer-quit' (Recursive Editing): Document throwing of function values to `exit'. * doc/lispref/errors.texi (Standard Errors): Document `minibuffer-quit' * lisp/minibuffer.el (minibuffer-quit-recursive-edit): New function. * lisp/simple.el (minibuffer-error-function): Do not abort keyboard macro execution if is minibuffer-quit is signaled (bug#48603). * src/data.c (syms_of_data): New error symbol `minibuffer-quit' * src/keyboard.c (recursive_edit_1): Implement throwing of function values to `exit`. In that case, the function will be called without arguments before returning from the command loop. (cmd_error): (Fcommand_error_default_function): Do not abort keyboard macro execution if minibuffer-quit is signaled. (command_loop_2): New argument HANDLERS. * src/macros.c (Fexecute_kbd_macro): Use command_loop_2 instead of command_loop_1. * src/minibuf.c (Fabort_minibuffers): Use it. --- src/keyboard.c | 45 +++++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) (limited to 'src/keyboard.c') diff --git a/src/keyboard.c b/src/keyboard.c index 77d6bbba623..db934686594 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -725,6 +725,9 @@ recursive_edit_1 (void) if (STRINGP (val)) xsignal1 (Qerror, val); + if (FUNCTIONP (val)) + call0 (val); + return unbind_to (count, Qnil); } @@ -921,6 +924,7 @@ static Lisp_Object cmd_error (Lisp_Object data) { Lisp_Object old_level, old_length; + Lisp_Object conditions; char macroerror[sizeof "After..kbd macro iterations: " + INT_STRLEN_BOUND (EMACS_INT)]; @@ -940,10 +944,15 @@ cmd_error (Lisp_Object data) else *macroerror = 0; + conditions = Fget (XCAR (data), Qerror_conditions); + if (NILP (Fmemq (Qminibuffer_quit, conditions))) + { + Vexecuting_kbd_macro = Qnil; + executing_kbd_macro = Qnil; + } + Vstandard_output = Qt; Vstandard_input = Qt; - Vexecuting_kbd_macro = Qnil; - executing_kbd_macro = Qnil; kset_prefix_arg (current_kboard, Qnil); kset_last_prefix_arg (current_kboard, Qnil); cancel_echoing (); @@ -998,6 +1007,7 @@ Default value of `command-error-function'. */) (Lisp_Object data, Lisp_Object context, Lisp_Object signal) { struct frame *sf = SELECTED_FRAME (); + Lisp_Object conditions; CHECK_STRING (context); @@ -1024,17 +1034,27 @@ Default value of `command-error-function'. */) } else { + conditions = Fget (XCAR (data), Qerror_conditions); + clear_message (1, 0); - Fdiscard_input (); message_log_maybe_newline (); - bitch_at_user (); + + if (!NILP (Fmemq (Qminibuffer_quit, conditions))) + { + Fding (Qt); + } + else + { + Fdiscard_input (); + bitch_at_user (); + } print_error_message (data, Qt, SSDATA (context), signal); } return Qnil; } -static Lisp_Object command_loop_2 (Lisp_Object); +static Lisp_Object command_loop_1 (void); static Lisp_Object top_level_1 (Lisp_Object); /* Entry to editor-command-loop. @@ -1062,7 +1082,7 @@ command_loop (void) if (command_loop_level > 0 || minibuf_level > 0) { Lisp_Object val; - val = internal_catch (Qexit, command_loop_2, Qnil); + val = internal_catch (Qexit, command_loop_2, Qerror); executing_kbd_macro = Qnil; return val; } @@ -1070,7 +1090,7 @@ command_loop (void) while (1) { internal_catch (Qtop_level, top_level_1, Qnil); - internal_catch (Qtop_level, command_loop_2, Qnil); + internal_catch (Qtop_level, command_loop_2, Qerror); executing_kbd_macro = Qnil; /* End of file in -batch run causes exit here. */ @@ -1083,15 +1103,16 @@ command_loop (void) editing loop, and reenter the editing loop. When there is an error, cmd_error runs and returns a non-nil value to us. A value of nil means that command_loop_1 itself - returned due to end of file (or end of kbd macro). */ + returned due to end of file (or end of kbd macro). HANDLERS is a + list of condition names, passed to internal_condition_case. */ -static Lisp_Object -command_loop_2 (Lisp_Object ignore) +Lisp_Object +command_loop_2 (Lisp_Object handlers) { register Lisp_Object val; do - val = internal_condition_case (command_loop_1, Qerror, cmd_error); + val = internal_condition_case (command_loop_1, handlers, cmd_error); while (!NILP (val)); return Qnil; @@ -1234,7 +1255,7 @@ static int read_key_sequence (Lisp_Object *, Lisp_Object, bool, bool, bool, bool); static void adjust_point_for_property (ptrdiff_t, bool); -Lisp_Object +static Lisp_Object command_loop_1 (void) { modiff_count prev_modiff = 0; -- cgit v1.2.1 From da4b3973deb5eb271d79568092ad25560b65dbf8 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 21 Jul 2021 16:53:54 +0200 Subject: Make `C-g' after `M-x' not give a backtrace unless required * src/eval.c (signal_quit_p): New function. (maybe_call_debugger): React to all `quit' signals (bug#49675). * src/keyboard.c (cmd_error_internal, menu_item_eval_property_1): Ditto. --- src/keyboard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/keyboard.c') diff --git a/src/keyboard.c b/src/keyboard.c index db934686594..38118071a80 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -985,7 +985,7 @@ cmd_error_internal (Lisp_Object data, const char *context) { /* The immediate context is not interesting for Quits, since they are asynchronous. */ - if (EQ (XCAR (data), Qquit)) + if (signal_quit_p (XCAR (data))) Vsignaling_function = Qnil; Vquit_flag = Qnil; @@ -7634,7 +7634,7 @@ menu_item_eval_property_1 (Lisp_Object arg) { /* If we got a quit from within the menu computation, quit all the way out of it. This takes care of C-] in the debugger. */ - if (CONSP (arg) && EQ (XCAR (arg), Qquit)) + if (CONSP (arg) && signal_quit_p (XCAR (arg))) quit (); return Qnil; -- cgit v1.2.1 From 903ecd7bea7d8f99a7dc84150728219283d79bf0 Mon Sep 17 00:00:00 2001 From: Logan Perkins Date: Wed, 21 Jul 2021 17:56:20 +0200 Subject: Make input of multi-key inputs in different emacsclients more logical * src/keyboard.c (read_key_sequence): Don't continue the input of multi-key commands in one emacsclient in another (bug#39687). --- src/keyboard.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/keyboard.c') diff --git a/src/keyboard.c b/src/keyboard.c index 38118071a80..820229cf8fe 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -9619,17 +9619,23 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt, (interrupted_kboard, Fcons (make_lispy_switch_frame (frame), KVAR (interrupted_kboard, kbd_queue))); + mock_input = 0; + } + else + { + if (FIXNUMP (key) && XFIXNUM (key) != -2) + { + /* If interrupted while initializing terminal, we + need to replay the interrupting key. See + Bug#5095 and Bug#37782. */ + mock_input = 1; + keybuf[0] = key; + } + else + { + mock_input = 0; + } } - if (FIXNUMP (key) && XFIXNUM (key) != -2) - { - /* If interrupted while initializing terminal, we - need to replay the interrupting key. See - Bug#5095 and Bug#37782. */ - mock_input = 1; - keybuf[0] = key; - } - else - mock_input = 0; goto replay_entire_sequence; } } -- cgit v1.2.1