From 66c598a4e6fa3104e139a35a0758b4c8a4eb17cb Mon Sep 17 00:00:00 2001 From: Alexander M Date: Sat, 15 Apr 2017 16:13:11 +0200 Subject: [PATCH] fetch a window even if its index is larger than window-count The index of a window in window-vector can be greater than the number of live windows if its number was assigned by winum-assign-func. also partly fixes #4 --- winum.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/winum.el b/winum.el index d4da7f8..257af3e 100644 --- a/winum.el +++ b/winum.el @@ -314,8 +314,9 @@ PREFIX must be a key sequence, like the ones returned by `kbd'." ;;;###autoload (defun winum-get-window-by-number (n) "Return window numbered N if exists, nil otherwise." - (when (and (>= n 0) (< n (1+ winum--window-count))) - (aref (winum--get-window-vector) n))) + (let ((window-vector (winum--get-window-vector))) + (when (and (>= n 0) (< n (length window-vector))) + (aref window-vector n)))) ;;;###autoload (defun winum-get-number-string (&optional window)