update doctstrings, comments and reindent
This commit is contained in:
parent
e9f3e96892
commit
a77e97fd0f
35
winum.el
35
winum.el
|
@ -37,21 +37,16 @@
|
||||||
|
|
||||||
(eval-when-compile (require 'cl))
|
(eval-when-compile (require 'cl))
|
||||||
|
|
||||||
;; TODO 0 should only be assigned manually
|
;; FIXME: Error during redisplay: (eval (winum-get-number-string)) signaled
|
||||||
;; -> what to do to not waste the 0 key then ?
|
;; (wrong-type-argument numberp nil) when opening a helm buffer.
|
||||||
;; -> assign "\M-0" to `select-window-10' in the keymap
|
|
||||||
;; -> what to do with `select-window-0' then ?
|
|
||||||
;; TODO make mode-line installation optional
|
|
||||||
;; TODO bug: Error during redisplay: (eval (winum-get-number-string)) signaled
|
|
||||||
;; (wrong-type-argument numberp nil) when opening a helm buffer.
|
|
||||||
|
|
||||||
(defgroup winum nil
|
(defgroup winum nil
|
||||||
"Navigate and manage windows using numbers."
|
"Navigate and manage windows using numbers."
|
||||||
:group 'convenience)
|
:group 'convenience)
|
||||||
|
|
||||||
;; TODO bug: when changed from frame-local to non-local in customize, need to
|
;; FIXME: when changed from frame-local to non-local in customize, need to
|
||||||
;; force update or `winum-get-number' fails and messes the
|
;; force update or `winum-get-number' fails and messes the
|
||||||
;; modeline until next update.
|
;; modeline until next update.
|
||||||
(defcustom winum-scope 'global
|
(defcustom winum-scope 'global
|
||||||
"Frames affected by a number set."
|
"Frames affected by a number set."
|
||||||
:group 'winum
|
:group 'winum
|
||||||
|
@ -67,14 +62,16 @@ Has effect only when `winum-scope' is not 'frame-local."
|
||||||
:type 'boolean)
|
:type 'boolean)
|
||||||
|
|
||||||
(defcustom winum-auto-assign-0-to-minibuffer t
|
(defcustom winum-auto-assign-0-to-minibuffer t
|
||||||
"If non-nil, `winum-mode' assigns 0 to the minibuffer if active."
|
"If non-nil, `winum-mode' assigns 0 to the minibuffer when active."
|
||||||
:group 'winum
|
:group 'winum
|
||||||
:type 'boolean)
|
:type 'boolean)
|
||||||
|
|
||||||
(defcustom winum-assign-func nil
|
(defcustom winum-assign-func nil
|
||||||
"Function called for each window by `winum-mode'.
|
"Function called for each window by `winum-mode'.
|
||||||
This is called before automatic assignment begins. The function should
|
This is called before automatic assignment begins. The function should
|
||||||
return a number to have it assigned to the current-window, nil otherwise."
|
return a number to have it assigned to the current-window, nil otherwise.
|
||||||
|
This function along with `winum-auto-assign-0-to-minibuffer' are the only
|
||||||
|
ways to have 0 assigned to a window."
|
||||||
:group 'winum
|
:group 'winum
|
||||||
:type 'function)
|
:type 'function)
|
||||||
|
|
||||||
|
@ -229,8 +226,7 @@ There are several ways to provide the number:
|
||||||
(defun winum-get-window-by-number (n)
|
(defun winum-get-window-by-number (n)
|
||||||
"Return window numbered N if exists."
|
"Return window numbered N if exists."
|
||||||
(let ((windows (if (eq winum-scope 'frame-local)
|
(let ((windows (if (eq winum-scope 'frame-local)
|
||||||
(car (gethash (selected-frame)
|
(car (gethash (selected-frame) winum--frames-table))
|
||||||
winum--frames-table))
|
|
||||||
winum--window-vector))
|
winum--window-vector))
|
||||||
window)
|
window)
|
||||||
(if (and (>= n 0) (< n (1+ winum--window-count))
|
(if (and (>= n 0) (< n (1+ winum--window-count))
|
||||||
|
@ -255,11 +251,10 @@ WINDOW: if specified, the window of which we want to know the number.
|
||||||
returned."
|
returned."
|
||||||
(let ((w (or window (selected-window))))
|
(let ((w (or window (selected-window))))
|
||||||
(if (eq winum-scope 'frame-local)
|
(if (eq winum-scope 'frame-local)
|
||||||
(gethash w (cdr (gethash (selected-frame)
|
(gethash w (cdr (gethash (selected-frame) winum--frames-table)))
|
||||||
winum--frames-table)))
|
|
||||||
(gethash w winum--numbers-table))))
|
(gethash w winum--numbers-table))))
|
||||||
|
|
||||||
;; Internal variables
|
;; Implementation
|
||||||
|
|
||||||
(defvar winum--max-frames 16
|
(defvar winum--max-frames 16
|
||||||
"Maximum number of frames that can be numbered.")
|
"Maximum number of frames that can be numbered.")
|
||||||
|
@ -424,8 +419,7 @@ Returns the assigned number, or nil on error."
|
||||||
This vector is not stored the same way depending on the value of
|
This vector is not stored the same way depending on the value of
|
||||||
`winum-scope'."
|
`winum-scope'."
|
||||||
(if (eq winum-scope 'frame-local)
|
(if (eq winum-scope 'frame-local)
|
||||||
(car (gethash (selected-frame)
|
(car (gethash (selected-frame) winum--frames-table))
|
||||||
winum--frames-table))
|
|
||||||
winum--window-vector))
|
winum--window-vector))
|
||||||
|
|
||||||
(defun winum--get-numbers-table ()
|
(defun winum--get-numbers-table ()
|
||||||
|
@ -433,8 +427,7 @@ This vector is not stored the same way depending on the value of
|
||||||
This hashtable is not stored the same way depending on the value of
|
This hashtable is not stored the same way depending on the value of
|
||||||
`winum-scope'"
|
`winum-scope'"
|
||||||
(if (eq winum-scope 'frame-local)
|
(if (eq winum-scope 'frame-local)
|
||||||
(cdr (gethash (selected-frame)
|
(cdr (gethash (selected-frame) winum--frames-table))
|
||||||
winum--frames-table))
|
|
||||||
winum--numbers-table))
|
winum--numbers-table))
|
||||||
|
|
||||||
(defun winum--available-numbers ()
|
(defun winum--available-numbers ()
|
||||||
|
|
Loading…
Reference in a new issue