Function: throw

throw is a function defined in eval.c.

Signature

(throw TAG VALUE)

Documentation

Throw to the catch for TAG and return VALUE from it.

Both TAG and VALUE are evalled.

Probably introduced at or before Emacs version 28.1.

Aliases

cl--block-throw

Source Code

// Defined in /usr/src/emacs/src/eval.c
{
  struct handler *c;

  if (!NILP (tag))
    for (c = handlerlist; c; c = c->next)
      {
	if (c->type == CATCHER_ALL)
          unwind_to_catch (c, NONLOCAL_EXIT_THROW, Fcons (tag, value));
        if (c->type == CATCHER && EQ (c->tag_or_ch, tag))
	  unwind_to_catch (c, NONLOCAL_EXIT_THROW, value);
      }
  xsignal2 (Qno_catch, tag, value);
}