branch: elpa/iwindow
commit 16c6c971431b4a7303d374c5afa51b10427af6ab
Author: Akib Azmain Turja <a...@disroot.org>
Commit: Akib Azmain Turja <a...@disroot.org>

    Don't error when PREDICATE is nil
---
 iwindow.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/iwindow.el b/iwindow.el
index b06464f51a..c808bd26f9 100644
--- a/iwindow.el
+++ b/iwindow.el
@@ -99,14 +99,15 @@ CALLBACK and revert the changes it has done."
 (defun iwindow--make-decision-tree (windows start end predicate)
   "Make a decision tree from window in WINDOWS from START to END.
 
-Don't include windows for which PREDICATE returns nil.
+Don't include windows for which PREDICATE returns nil, if PREDICATE is
+non-nil.
 
 Return an object OPTION, where OPTION is either a window, nil, or a
 list of form (OPTION...), whose length of no more than the length of
 `iwindow-selection-keys'."
   (if (= (- end start) 1)
       (let ((window (aref windows start)))
-        (when (funcall predicate window)
+        (when (or (not predicate) (funcall predicate window))
           window))
     (let ((result nil)
           (option-count (length iwindow-selection-keys)))

Reply via email to