add custom variable winum-format

This commit is contained in:
deb0ch 2018-11-19 18:05:09 +01:00
parent 8bafa66f80
commit b27b8f4db7
2 changed files with 39 additions and 19 deletions

View file

@ -4,7 +4,9 @@
* Contents :TOC:noexport: * Contents :TOC:noexport:
- [[#introduction][Introduction]] - [[#introduction][Introduction]]
- [[#whats-changed-since-window-numbering][What's changed since window-numbering]] - [[#changelog][Changelog]]
- [[#nov-15-2018][Nov. 15 2018]]
- [[#initial-release-whats-changed-since-window-numbering][Initial release: what's changed since window-numbering]]
- [[#installation][Installation]] - [[#installation][Installation]]
- [[#using-melpa][Using Melpa]] - [[#using-melpa][Using Melpa]]
- [[#manual-installation][Manual installation]] - [[#manual-installation][Manual installation]]
@ -25,7 +27,12 @@ from [[https://github.com/abo-abo/ace-window][ace-window]].
This version brings, among other things, support for number sets across multiple This version brings, among other things, support for number sets across multiple
frames, giving the user a smoother experience of multi-screen Emacs. frames, giving the user a smoother experience of multi-screen Emacs.
* What's changed since window-numbering * Changelog
** Nov. 15 2018
- Added customize variable =winum-format=, a format string to configure how the
window number appears in the mode-line
** Initial release: what's changed since window-numbering
This package brings a lot of additions to the old window-numbering: This package brings a lot of additions to the old window-numbering:
- Number sets across multiple frames, giving a smoother experience of - Number sets across multiple frames, giving a smoother experience of
@ -241,6 +248,14 @@ Several options are available through Emacs' Customize interface under
Default: =t= Default: =t=
- =winum-format=
Format string defining how the window number looks like in the mode-line.
This string is passed to the =format= function along with the result of
=winum-get-number-string=.
Default: =" %s "=
- =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.
@ -297,6 +312,7 @@ available winum options.
winum-auto-assign-0-to-minibuffer t winum-auto-assign-0-to-minibuffer t
winum-assign-func 'my-winum-assign-func winum-assign-func 'my-winum-assign-func
winum-auto-setup-mode-line t winum-auto-setup-mode-line t
winum-format " %s "
winum-mode-line-position 1 winum-mode-line-position 1
winum-ignored-buffers '(" *which-key*")) winum-ignored-buffers '(" *which-key*"))
@ -321,9 +337,4 @@ available winum options.
- Autocomplete read-from-minibuffer - Autocomplete read-from-minibuffer
- Add =winum-format= customize variable
Format string for displaying the window number in the mode-line. Default to
" %n " to get a space on each side of the window number.
- Things that you have thought of and I haven't :smile_cat: - Things that you have thought of and I haven't :smile_cat:

View file

@ -143,6 +143,13 @@ numbers in the mode-line."
:group 'winum :group 'winum
:type 'integer) :type 'integer)
(defcustom winum-format " %s "
"Format string defining how the window number looks like in the mode-line.
This string is passed to the `format' function along with the
result of `winum-get-number-string'."
:group 'winum
:type 'string)
(defcustom winum-ignored-buffers '(" *which-key*") (defcustom winum-ignored-buffers '(" *which-key*")
"List of buffers to ignore when assigning numbers." "List of buffers to ignore when assigning numbers."
:group 'winum :group 'winum
@ -208,6 +215,10 @@ To get a number given a window, use the `cdr' of a value.
Such a structure allows for per-frame bidirectional fast access.") Such a structure allows for per-frame bidirectional fast access.")
(defvar winum--mode-line-segment
'(:eval (format winum-format (winum-get-number-string)))
"What is pushed into `mode-line-format' when setting it up automatically.")
(defvar winum--last-used-scope winum-scope (defvar winum--last-used-scope winum-scope
"Tracks the last used `winum-scope'. "Tracks the last used `winum-scope'.
Needed to detect scope changes at runtime.") Needed to detect scope changes at runtime.")
@ -404,8 +415,6 @@ WINDOW: if specified, the window of which we want to know the number.
(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))
(defvar winum--mode-line-segment '(:eval (winum-get-number-string)))
(defun winum--install-mode-line (&optional position) (defun winum--install-mode-line (&optional position)
"Install the window number from `winum-mode' to the mode-line. "Install the window number from `winum-mode' to the mode-line.
POSITION: position in the mode-line." POSITION: position in the mode-line."