branch: master
commit fd4640566fbccc58a452611517ad715c3f159e14
Author: Alexey Veretennikov <[email protected]>
Commit: Alexey Veretennikov <[email protected]>
Fixed recursion problem
---
ztree.el | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/ztree.el b/ztree.el
index 3933939..4391b95 100644
--- a/ztree.el
+++ b/ztree.el
@@ -104,10 +104,11 @@
(defun ztree-find (where which)
"find element of the list `where` matching predicate `which`"
- (if where
- (if (funcall which (car where))
- (car where)
- (ztree-find (cdr where) which))))
+ (catch 'found
+ (dolist (elt where)
+ (when (funcall which elt)
+ (throw 'found elt)))
+ nil))
(defun ztree-filter (condp lst)
"Filter out elements of the list `lst` not satisfying predicate `condp`.