[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
stack overflow with (re-search-forward "..." nil t)
From: |
Drew Adams |
Subject: |
stack overflow with (re-search-forward "..." nil t) |
Date: |
Mon, 4 Jul 2005 20:31:54 -0700 |
I don't understand the `noerror' argument to re-search-forward, when it is
`t'. For some kinds of errors it works, but I still get stack-overflow
errors signaled, instead of the function returning nil. The doc string and
Elisp manual simply say that `noerror'=t returns nil in case of error.
As a workaround, I'm wrapping the call in condition-case, and that works
fine:
(condition-case nil
(re-search-forward hairy-regexp nil t)
(error nil))
But I would like to understand the stack-overflow behavior. Why doesn't
re-search-forward itself use the equivalent of a condition-case wrapper to
ensure that nil is returned in case of an error? If that can't be done
easily in C, why isn't the function defined using a Lisp wrapper that does a
condition-case?
- stack overflow with (re-search-forward "..." nil t),
Drew Adams <=