Function: abort-minibuffers

abort-minibuffers is an interactive function defined in minibuf.c.

Signature

(abort-minibuffers)

Documentation

Abort the current minibuffer.

If we are not currently in the innermost minibuffer, prompt the user to confirm the aborting of the current minibuffer and all contained ones.

Key Bindings

Source Code

// Defined in /usr/src/emacs/src/minibuf.c
{
  EMACS_INT minibuf_depth = this_minibuffer_depth (Qnil);
  Lisp_Object array[2];
  AUTO_STRING (fmt, "Abort %s minibuffer levels? ");

  if (!minibuf_depth)
    error ("Not in a minibuffer");
  if (NILP (Fminibuffer_innermost_command_loop_p (Qnil)))
    error ("Not in most nested command loop");
  if (minibuf_depth < minibuf_level)
    {
      array[0] = fmt;
      array[1] = make_fixnum (minibuf_level - minibuf_depth + 1);
      if (!NILP (Fyes_or_no_p (Fformat (2, array))))
	{
	  /* Due to the above check, the current minibuffer is in the
	     most nested command loop, which means that we don't have
	     to abort any extra non-minibuffer recursive edits.  Thus,
	     the number of recursive edits we have to abort equals the
	     number of minibuffers we have to abort.  */
	  call1 (Qminibuffer_quit_recursive_edit, array[1]);
	}
    }
  else
    call0 (Qminibuffer_quit_recursive_edit);
  return Qnil;
}