Skip to content

Commit 0e10a9d

Browse files
Alexander-MillerThomas de Beauchêne
authored andcommitted
Add verification for winum--frames-table
1 parent cf691de commit 0e10a9d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

winum.el

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,24 @@ This vector is not stored the same way depending on the value of `winum-scope'."
552552
This hashtable is not stored the same way depending on the value of
553553
`winum-scope'"
554554
(winum--check-for-scope-change)
555+
(winum--check-frames-table)
555556
(if (eq winum-scope 'frame-local)
556557
(cdr (gethash (selected-frame) winum--frames-table))
557558
winum--numbers-table))
558559

560+
(defun winum--check-frames-table ()
561+
"Make sure `winum--frames-table' exists and is correctly equipped.
562+
Verifies 2 things (when `winum-scope' is frame local):
563+
* When `winum-scope' is frame-local for the first time it may be necessary to
564+
instantiate `winum--frames-table'.
565+
* A table entry for the current frame must be made when the frame has just
566+
been created."
567+
(when (eq winum-scope 'frame-local)
568+
(unless winum--frames-table
569+
(setq winum--frames-table (make-hash-table :size winum--max-frames)))
570+
(unless (gethash (selected-frame) winum--frames-table)
571+
(winum--update))))
572+
559573
(defun winum--available-numbers ()
560574
"Return a list of numbers from 1 to `winum--window-count'.
561575
0 is is not part of the list as its assignment is either manual

0 commit comments

Comments
 (0)