Function: command-error-default-function

command-error-default-function is a function defined in keyboard.c.

Signature

(command-error-default-function DATA CONTEXT SIGNAL)

Documentation

Produce default output for unhandled error message.

Default value of command-error-function.

Source Code

// Defined in /usr/src/emacs/src/keyboard.c
{
  struct frame *sf = SELECTED_FRAME ();
  Lisp_Object conditions = Fget (XCAR (data), Qerror_conditions);
  int is_minibuffer_quit = !NILP (Fmemq (Qminibuffer_quit, conditions));

  CHECK_STRING (context);

  /* If the window system or terminal frame hasn't been initialized
     yet, or we're not interactive, write the message to stderr and exit.
     Don't do this for the minibuffer-quit condition.  */
  if (!is_minibuffer_quit
      && (!sf->glyphs_initialized_p
	  /* The initial frame is a special non-displaying frame. It
	     will be current in daemon mode when there are no frames
	     to display, and in non-daemon mode before the real frame
	     has finished initializing.  If an error is thrown in the
	     latter case while creating the frame, then the frame
	     will never be displayed, so the safest thing to do is
	     write to stderr and quit.  In daemon mode, there are
	     many other potential errors that do not prevent frames
	     from being created, so continuing as normal is better in
	     that case, as long as the daemon has actually finished
	     initialization. */
	  || (!(IS_DAEMON && !DAEMON_RUNNING) && FRAME_INITIAL_P (sf))
	  || noninteractive))
    {
      print_error_message (data, Qexternal_debugging_output,
			   SSDATA (context), signal);
      Fterpri (Qexternal_debugging_output, Qnil);
      Fkill_emacs (make_fixnum (-1), Qnil);
    }
  else
    {
      clear_message (1, 0);
      message_log_maybe_newline ();

      if (is_minibuffer_quit)
	{
	  Fding (Qt);
	}
      else
	{
	  Fdiscard_input ();
	  bitch_at_user ();
	}

      print_error_message (data, Qt, SSDATA (context), signal);
    }
  return Qnil;
}