make mode-line installation optional

This commit is contained in:
deb0ch 2016-12-04 20:38:42 +01:00
parent 5ebcd92341
commit b862a0243c
2 changed files with 17 additions and 2 deletions

View file

@ -117,6 +117,14 @@ Example: always assign the calculator window the number 9:
(lambda () (when (equal (buffer-name) "*Calculator*") 9))) (lambda () (when (equal (buffer-name) "*Calculator*") 9)))
#+END_SRC #+END_SRC
- =winum-auto-setup-mode-line=
When nil, `winum-mode' will not display window numbers in the mode-line.
You might want this to be nil if you use a package that already manages window
numbers in the mode-line.
Default: t
- =winum-mode-line-position= - =winum-mode-line-position=
The position in the mode-line `winum-mode' displays the number. The position in the mode-line `winum-mode' displays the number.

View file

@ -78,6 +78,11 @@ return a number to have it assigned to the current-window, nil otherwise."
:group 'winum :group 'winum
:type 'function) :type 'function)
(defcustom winum-auto-setup-mode-line t
"When nil, `winum-mode' will not display window numbers in the mode-line.
You might want this to be nil if you use a package that already manages window
numbers in the mode-line.")
(defcustom winum-mode-line-position 1 (defcustom winum-mode-line-position 1
"The position in the mode-line `winum-mode' displays the number." "The position in the mode-line `winum-mode' displays the number."
:group 'winum :group 'winum
@ -295,7 +300,8 @@ Such a structure allows for per-frame bidirectional fast access.")
(if (eq winum-scope 'frame-local) (if (eq winum-scope 'frame-local)
(setq winum--frames-table (make-hash-table :size winum--max-frames)) (setq winum--frames-table (make-hash-table :size winum--max-frames))
(setq winum--numbers-table (make-hash-table :size winum--window-count))) (setq winum--numbers-table (make-hash-table :size winum--window-count)))
(winum--install-mode-line) (when winum-auto-setup-mode-line
(winum--install-mode-line))
(add-hook 'minibuffer-setup-hook 'winum--update) (add-hook 'minibuffer-setup-hook 'winum--update)
(add-hook 'window-configuration-change-hook 'winum--update) (add-hook 'window-configuration-change-hook 'winum--update)
(dolist (frame (frame-list)) (dolist (frame (frame-list))
@ -304,7 +310,8 @@ Such a structure allows for per-frame bidirectional fast access.")
(defun winum--deinit () (defun winum--deinit ()
"Actions performed when turning off winum-mode." "Actions performed when turning off winum-mode."
(winum--clear-mode-line) (when winum-auto-setup-mode-line
(winum--clear-mode-line))
(remove-hook 'minibuffer-setup-hook 'winum--update) (remove-hook 'minibuffer-setup-hook 'winum--update)
(remove-hook 'window-configuration-change-hook 'winum--update) (remove-hook 'window-configuration-change-hook 'winum--update)
(setq winum--frames-table nil)) (setq winum--frames-table nil))