Function: recursive-edit

recursive-edit is an interactive function defined in keyboard.c.

Signature

(recursive-edit)

Documentation

Invoke the editor command loop recursively.

To get out of the recursive edit, a command can throw to exit -- for instance (throw 'exit nil).

The following values (last argument to throw) can be used when throwing to 'exit:

- t causes recursive-edit to quit, so that control returns to the
  command loop one level up.

- A string causes recursive-edit to signal an error, printing that
  string as the error message.

- A function causes recursive-edit to call that function with no
  arguments, and then return normally.

- Any other value causes recursive-edit to return normally to the
  function that called it.

This function is called by the editor initialization to begin editing.

View in manual

Key Bindings

Source Code

// Defined in /usr/src/emacs/src/keyboard.c
{
  specpdl_ref count = SPECPDL_INDEX ();
  Lisp_Object buffer;

  /* If we enter while input is blocked, don't lock up here.
     This may happen through the debugger during redisplay.  */
  if (input_blocked_p ())
    return Qnil;

  if (command_loop_level >= 0
      && current_buffer != XBUFFER (XWINDOW (selected_window)->contents))
    buffer = Fcurrent_buffer ();
  else
    buffer = Qnil;

  /* Don't do anything interesting between the increment and the
     record_unwind_protect!  Otherwise, we could get distracted and
     never decrement the counter again.  */
  command_loop_level++;
  update_mode_lines = 17;
  record_unwind_protect (recursive_edit_unwind, buffer);

  /* If we leave recursive_edit_1 below with a `throw' for instance,
     like it is done in the splash screen display, we have to
     make sure that we restore single_kboard as command_loop_1
     would have done if it were left normally.  */
  if (command_loop_level > 0)
    temporarily_switch_to_single_kboard (SELECTED_FRAME ());

  recursive_edit_1 ();
  return unbind_to (count, Qnil);
}