rename internal variables to follow elisp conventions
This commit is contained in:
parent
bcccadcf12
commit
b80f9ce36c
|
@ -104,7 +104,7 @@ Has effect only when `window-numbering-frame-scope' is not 'frame-local."
|
||||||
"Face used for the number in the mode-line."
|
"Face used for the number in the mode-line."
|
||||||
:group 'window-numbering)
|
:group 'window-numbering)
|
||||||
|
|
||||||
(defvar window-numbering-table nil
|
(defvar window-numbering--frames-table nil
|
||||||
"table -> (window vector . number table)")
|
"table -> (window vector . number table)")
|
||||||
|
|
||||||
(defun select-window-by-number (i &optional arg)
|
(defun select-window-by-number (i &optional arg)
|
||||||
|
@ -113,8 +113,8 @@ If prefix ARG is given, delete the window instead of selecting it."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(let ((windows (if (eq window-numbering-frame-scope 'frame-local)
|
(let ((windows (if (eq window-numbering-frame-scope 'frame-local)
|
||||||
(car (gethash (selected-frame)
|
(car (gethash (selected-frame)
|
||||||
window-numbering-table))
|
window-numbering--frames-table))
|
||||||
window-numbering-windows))
|
window-numbering--windows))
|
||||||
window)
|
window)
|
||||||
(if (and (>= i 0) (< i 10)
|
(if (and (>= i 0) (< i 10)
|
||||||
(setq window (aref windows i)))
|
(setq window (aref windows i)))
|
||||||
|
@ -139,39 +139,41 @@ If prefix ARG is given, delete the window instead of selecting it."
|
||||||
(decf i))
|
(decf i))
|
||||||
left))
|
left))
|
||||||
|
|
||||||
(defvar window-numbering-windows nil
|
(defvar window-numbering--windows nil
|
||||||
"A vector listing the window for each number.")
|
"A vector listing the window for each number.")
|
||||||
(defvar window-numbering-numbers
|
|
||||||
|
(defvar window-numbering--numbers nil
|
||||||
"A hash map containing each window's number.")
|
"A hash map containing each window's number.")
|
||||||
(defvar window-numbering-left
|
|
||||||
|
(defvar window-numbering--left nil
|
||||||
"A list of unused window numbers.")
|
"A list of unused window numbers.")
|
||||||
|
|
||||||
(defun window-numbering-assign (window &optional number)
|
(defun window-numbering-assign (window &optional number)
|
||||||
(if number
|
(if number
|
||||||
(if (aref window-numbering-windows number)
|
(if (aref window-numbering--windows number)
|
||||||
(progn (message "Number %s assigned to two buffers (%s and %s)"
|
(progn (message "Number %s assigned to two buffers (%s and %s)"
|
||||||
number window (aref window-numbering-windows number))
|
number window (aref window-numbering--windows number))
|
||||||
nil)
|
nil)
|
||||||
(setf (aref window-numbering-windows number) window)
|
(setf (aref window-numbering--windows number) window)
|
||||||
(puthash window number window-numbering-numbers)
|
(puthash window number window-numbering--numbers)
|
||||||
(setq window-numbering-left (delq number window-numbering-left))
|
(setq window-numbering--left (delq number window-numbering--left))
|
||||||
number)
|
number)
|
||||||
;; else determine number and assign
|
;; else determine number and assign
|
||||||
(when window-numbering-left
|
(when window-numbering--left
|
||||||
(unless (gethash window window-numbering-numbers)
|
(unless (gethash window window-numbering--numbers)
|
||||||
(let ((number (car window-numbering-left)))
|
(let ((number (car window-numbering--left)))
|
||||||
(window-numbering-assign window number))))))
|
(window-numbering-assign window number))))))
|
||||||
|
|
||||||
(defun window-numbering-update ()
|
(defun window-numbering-update ()
|
||||||
"Update window numbers."
|
"Update window numbers."
|
||||||
(setq window-numbering-windows (make-vector 10 nil)
|
(setq window-numbering--windows (make-vector 10 nil)
|
||||||
window-numbering-numbers (make-hash-table :size 10)
|
window-numbering--numbers (make-hash-table :size 10)
|
||||||
window-numbering-left (window-numbering-calculate-left
|
window-numbering--left (window-numbering-calculate-left
|
||||||
window-numbering-windows))
|
window-numbering--windows))
|
||||||
(when (eq window-numbering-frame-scope 'frame-local)
|
(when (eq window-numbering-frame-scope 'frame-local)
|
||||||
(puthash (selected-frame)
|
(puthash (selected-frame)
|
||||||
(cons window-numbering-windows window-numbering-numbers)
|
(cons window-numbering--windows window-numbering--numbers)
|
||||||
window-numbering-table))
|
window-numbering--frames-table))
|
||||||
(when (and window-numbering-auto-assign-0-to-minibuffer
|
(when (and window-numbering-auto-assign-0-to-minibuffer
|
||||||
(active-minibuffer-window))
|
(active-minibuffer-window))
|
||||||
(window-numbering-assign (active-minibuffer-window) 0))
|
(window-numbering-assign (active-minibuffer-window) 0))
|
||||||
|
@ -237,8 +239,8 @@ If prefix ARG is given, delete the window instead of selecting it."
|
||||||
(let ((w (or window (selected-window))))
|
(let ((w (or window (selected-window))))
|
||||||
(if (eq window-numbering-frame-scope 'frame-local)
|
(if (eq window-numbering-frame-scope 'frame-local)
|
||||||
(gethash w (cdr (gethash (selected-frame)
|
(gethash w (cdr (gethash (selected-frame)
|
||||||
window-numbering-table)))
|
window-numbering--frames-table)))
|
||||||
(gethash w window-numbering-numbers))))
|
(gethash w window-numbering--numbers))))
|
||||||
|
|
||||||
(defvar window-numbering-keymap
|
(defvar window-numbering-keymap
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
|
@ -260,9 +262,9 @@ If prefix ARG is given, delete the window instead of selecting it."
|
||||||
"A minor mode that assigns a number to each window."
|
"A minor mode that assigns a number to each window."
|
||||||
nil nil window-numbering-keymap :global t
|
nil nil window-numbering-keymap :global t
|
||||||
(if window-numbering-mode
|
(if window-numbering-mode
|
||||||
(unless window-numbering-table
|
(unless window-numbering--frames-table
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(setq window-numbering-table (make-hash-table :size 16))
|
(setq window-numbering--frames-table (make-hash-table :size 16))
|
||||||
(window-numbering-install-mode-line)
|
(window-numbering-install-mode-line)
|
||||||
(add-hook 'minibuffer-setup-hook 'window-numbering-update)
|
(add-hook 'minibuffer-setup-hook 'window-numbering-update)
|
||||||
(add-hook 'window-configuration-change-hook
|
(add-hook 'window-configuration-change-hook
|
||||||
|
@ -274,7 +276,7 @@ If prefix ARG is given, delete the window instead of selecting it."
|
||||||
(remove-hook 'minibuffer-setup-hook 'window-numbering-update)
|
(remove-hook 'minibuffer-setup-hook 'window-numbering-update)
|
||||||
(remove-hook 'window-configuration-change-hook
|
(remove-hook 'window-configuration-change-hook
|
||||||
'window-numbering-update)
|
'window-numbering-update)
|
||||||
(setq window-numbering-table nil)))
|
(setq window-numbering--frames-table nil)))
|
||||||
|
|
||||||
(defun window-numbering-install-mode-line (&optional position)
|
(defun window-numbering-install-mode-line (&optional position)
|
||||||
"Install the window number from `window-numbering-mode' to the mode-line."
|
"Install the window number from `window-numbering-mode' to the mode-line."
|
||||||
|
|
Loading…
Reference in a new issue