update comments

This commit is contained in:
deb0ch 2016-11-30 01:52:10 +01:00
parent 9db55dc5ea
commit ed2e4722a3

View file

@ -27,41 +27,43 @@
;; ;;
;;; Commentary: ;;; Commentary:
;; ;;
;; An extended and actively maintained version of the window-numbering package ;; Window numbers for Emacs: Navigate your windows and frames using numbers.
;; written by Nikolaj Schumacher
;; ;;
;; Bla bla bla disclaimer, links & credits to original project, ace-window ;; This package is an extended and actively maintained version of the
;; etc... ;; https://github.com/nschum/window-numbering.el package by Nikolaj Schumacher,
;; with some ideas and code taken from https://github.com/abo-abo/ace-window.
;; ;;
;;; Code: ;;; Code:
(eval-when-compile (require 'cl)) (eval-when-compile (require 'cl))
;; TODO rename to 'winum.el' and keep backward compatibility
(defgroup window-numbering nil (defgroup window-numbering nil
"Navigate and manage windows using numbers." "Navigate and manage windows using numbers."
:group 'convenience) :group 'convenience)
;; TODO when changed from frame-local to non-local in customize, need to force ;; TODO bug: when changed from frame-local to non-local in customize, need to
;; update, or `window-numbering-get-number' fails and crashes the modeline ;; force update or `window-numbering-get-number' fails and messes the
;; until next update. ;; modeline until next update.
(defcustom window-numbering-scope 'global (defcustom window-numbering-scope 'global
"The scope of number sets." "The scope of number sets."
:group 'window-numbering :group 'window-numbering
:type '(choice :type '(choice
(const :tag "frame local" frame-local) (const :tag "frame local" frame-local)
(const :tag "visible frames" visible) (const :tag "visible frames" visible)
(const :tag "global" global))) (const :tag "global" global)))
(defcustom window-numbering-reverse-frame-list nil (defcustom window-numbering-reverse-frame-list nil
"If t, order frames by reverse order of creation. "If t, order frames by reverse order of creation.
Has effect only when `window-numbering-scope' is not 'frame-local." Has effect only when `window-numbering-scope' is not 'frame-local."
:group 'window-numbering :group 'window-numbering
:type 'boolean) :type 'boolean)
(defcustom window-numbering-auto-assign-0-to-minibuffer t (defcustom window-numbering-auto-assign-0-to-minibuffer t
"If non-nil, `window-numbering-mode' assigns 0 to the minibuffer if active." "If non-nil, `window-numbering-mode' assigns 0 to the minibuffer if active."
:group 'window-numbering :group 'window-numbering
:type 'boolean) :type 'boolean)
(defcustom window-numbering-before-hook nil (defcustom window-numbering-before-hook nil
"Hook called before `window-numbering-mode' starts assigning numbers. "Hook called before `window-numbering-mode' starts assigning numbers.
@ -70,19 +72,20 @@ Use `window-numbering--assign' to manually assign some of them a number.
If you want to assign a number to just one buffer, use If you want to assign a number to just one buffer, use
`window-numbering-assign-func' instead." `window-numbering-assign-func' instead."
:group 'window-numbering :group 'window-numbering
:type 'hook) :type 'hook)
(defcustom window-numbering-assign-func nil (defcustom window-numbering-assign-func nil
"Function called for each window by `window-numbering-mode'. "Function called for each window by `window-numbering-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."
:group 'window-numbering :group 'window-numbering
:type 'function) :type 'function)
(defcustom window-numbering-mode-line-position 1 (defcustom window-numbering-mode-line-position 1
"The position in the mode-line `window-numbering-mode' displays the number." "The position in the mode-line `window-numbering-mode' displays the number."
:group 'window-numbering :group 'window-numbering
:type 'integer) :type 'integer)
(defface window-numbering-face '() (defface window-numbering-face '()
"Face used for the number in the mode-line." "Face used for the number in the mode-line."
@ -105,9 +108,9 @@ return a number to have it assigned to the current-window, nil otherwise."
;;;###autoload ;;;###autoload
(define-minor-mode window-numbering-mode (define-minor-mode window-numbering-mode
"A minor mode that allows for managing windows based on window numbers." "A minor mode that allows for managing windows based on window numbers."
nil ; initial value of the mode variable nil
nil ; lighter (appearance in mode-line) nil
window-numbering-keymap ; keymap window-numbering-keymap
:global t :global t
(if window-numbering-mode (if window-numbering-mode
(window-numbering--init) (window-numbering--init)
@ -257,7 +260,6 @@ Such a structure allows for per-frame bidirectional fast access.")
'window-numbering--update) 'window-numbering--update)
(setq window-numbering--frames-table nil)) (setq window-numbering--frames-table nil))
;; TODO bug: mode-line is sometimes not updated in all visible frames
(defun window-numbering--update () (defun window-numbering--update ()
"Update window numbers." "Update window numbers."
(setq window-numbering--remaining (window-numbering--get-available-numbers)) (setq window-numbering--remaining (window-numbering--get-available-numbers))