Add verification for winum--frames-table

This commit is contained in:
Alexander Miller 2017-09-20 07:34:22 +02:00 committed by Thomas de Beauchêne
parent cf691de506
commit 0e10a9d29b

View file

@ -552,10 +552,24 @@ This vector is not stored the same way depending on the value of `winum-scope'."
This hashtable is not stored the same way depending on the value of
`winum-scope'"
(winum--check-for-scope-change)
(winum--check-frames-table)
(if (eq winum-scope 'frame-local)
(cdr (gethash (selected-frame) winum--frames-table))
winum--numbers-table))
(defun winum--check-frames-table ()
"Make sure `winum--frames-table' exists and is correctly equipped.
Verifies 2 things (when `winum-scope' is frame local):
* When `winum-scope' is frame-local for the first time it may be necessary to
instantiate `winum--frames-table'.
* A table entry for the current frame must be made when the frame has just
been created."
(when (eq winum-scope 'frame-local)
(unless winum--frames-table
(setq winum--frames-table (make-hash-table :size winum--max-frames)))
(unless (gethash (selected-frame) winum--frames-table)
(winum--update))))
(defun winum--available-numbers ()
"Return a list of numbers from 1 to `winum--window-count'.
0 is is not part of the list as its assignment is either manual