Compare commits

..

No commits in common. "c5455e866e8a5f7eab6a7263e2057aff5f1118b9" and "d7b7eecf0860c63eab9cc4013d08e2a4a83fcc5e" have entirely different histories.

2 changed files with 31 additions and 78 deletions

View file

@ -3,20 +3,17 @@
[[https://github.com/syl20bnr/spacemacs][file:https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg]] [[https://melpa.org/#/winum][file:https://melpa.org/packages/winum-badge.svg]] [[https://stable.melpa.org/#/winum][file:https://stable.melpa.org/packages/winum-badge.svg]] [[https://github.com/syl20bnr/spacemacs][file:https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg]] [[https://melpa.org/#/winum][file:https://melpa.org/packages/winum-badge.svg]] [[https://stable.melpa.org/#/winum][file:https://stable.melpa.org/packages/winum-badge.svg]]
* Contents :TOC:noexport: * Contents :TOC:noexport:
- [[#introduction][Introduction]] - [[#introduction][Introduction]]
- [[#changelog][Changelog]] - [[#whats-changed-since-window-numbering][What's changed since window-numbering]]
- [[#sep-11-2019][Sep. 11 2019]] - [[#installation][Installation]]
- [[#nov-15-2018][Nov. 15 2018]]
- [[#initial-release-whats-changed-since-window-numbering][Initial release: what's changed since window-numbering]]
- [[#installation][Installation]]
- [[#using-melpa][Using Melpa]] - [[#using-melpa][Using Melpa]]
- [[#manual-installation][Manual installation]] - [[#manual-installation][Manual installation]]
- [[#how-to-use][How to use]] - [[#how-to-use][How to use]]
- [[#configuration][Configuration]] - [[#configuration][Configuration]]
- [[#keybindings][Keybindings]] - [[#keybindings][Keybindings]]
- [[#customize-options][Customize options]] - [[#customize-options][Customize options]]
- [[#configuration-file-example][Configuration file example]] - [[#configuration-file-example][Configuration file example]]
- [[#future-developments][Future developments]] - [[#future-developments][Future developments]]
* Introduction * Introduction
Window numbers for Emacs: Navigate your windows and frames using numbers ! Window numbers for Emacs: Navigate your windows and frames using numbers !
@ -28,15 +25,7 @@ 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.
* Changelog * What's changed since window-numbering
** Sep. 11 2019
- Added customize variable =winum-ignored-buffers-regexp= to ignored buffers
based on regexps.
** 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
@ -235,7 +224,7 @@ Several options are available through Emacs' Customize interface under
((equal (buffer-name) "*Calculator*") 9) ((equal (buffer-name) "*Calculator*") 9)
((equal (buffer-name) "*Flycheck errors*") 8))) ((equal (buffer-name) "*Flycheck errors*") 8)))
(defun winum-assign-0-to-neotree () (defun winum-assign-0-to-neotree-and ()
(when (string-match-p (buffer-name) ".*\\*NeoTree\\*.*") 10)) (when (string-match-p (buffer-name) ".*\\*NeoTree\\*.*") 10))
(add-to-list 'winum-assign-functions #'winum-assign-9-to-calculator-8-to-flycheck-errors) (add-to-list 'winum-assign-functions #'winum-assign-9-to-calculator-8-to-flycheck-errors)
@ -252,14 +241,6 @@ 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.
@ -272,13 +253,6 @@ Several options are available through Emacs' Customize interface under
Default: '(" *which-key*") Default: '(" *which-key*")
- =winum-ignored-buffers-regexp=
List of regexps for buffer names. Matching buffers will be ignored when
assigning numbers. See [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Regexps.html][Emacs' documentation on regexps]] for syntax.
Default: '()
- face: =winum-face= - face: =winum-face=
Face used for the number in the mode-line. Face used for the number in the mode-line.
@ -310,7 +284,7 @@ available winum options.
((equal (buffer-name) "*Calculator*") 9) ((equal (buffer-name) "*Calculator*") 9)
((equal (buffer-name) "*Flycheck errors*") 8))) ((equal (buffer-name) "*Flycheck errors*") 8)))
(defun winum-assign-0-to-neotree () (defun winum-assign-0-to-neotree-and ()
(when (string-match-p (buffer-name) ".*\\*NeoTree\\*.*") 10)) (when (string-match-p (buffer-name) ".*\\*NeoTree\\*.*") 10))
(add-to-list 'winum-assign-functions #'winum-assign-9-to-calculator-8-to-flycheck-errors) (add-to-list 'winum-assign-functions #'winum-assign-9-to-calculator-8-to-flycheck-errors)
@ -323,10 +297,8 @@ 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*"))
winum-ignored-buffers-regexp '(" \\*Treemacs-.*"))
(winum-mode) (winum-mode)
#+END_SRC #+END_SRC
@ -349,4 +321,9 @@ 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

@ -17,7 +17,7 @@
;; along with this program. If not, see <http://www.gnu.org/licenses/>. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;; ;;
;; Author: Thomas de Beauchêne <thomas.de.beauchene@gmail.com> ;; Author: Thomas de Beauchêne <thomas.de.beauchene@gmail.com>
;; Version: 2.2.0 ;; Version: 2.0.0
;; Keywords: convenience, frames, windows, multi-screen ;; Keywords: convenience, frames, windows, multi-screen
;; URL: http://github.com/deb0ch/winum.el ;; URL: http://github.com/deb0ch/winum.el
;; Created: 2016 ;; Created: 2016
@ -143,25 +143,11 @@ 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
:type '(repeat string)) :type '(repeat string))
(defcustom winum-ignored-buffers-regexp '()
"List of regexps for buffer names to ignore when assigning numbers.
See Info node `(emacs) Regexps' or Info node `(elisp) Regular Expressions'"
:group 'winum
:type '(repeat string)
:risky t)
(defface winum-face '() (defface winum-face '()
"Face used for the number in the mode-line." "Face used for the number in the mode-line."
:group 'winum) :group 'winum)
@ -222,10 +208,6 @@ 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.")
@ -430,26 +412,23 @@ POSITION: position in the mode-line."
(dotimes (i (min (or position winum-mode-line-position 1) (dotimes (i (min (or position winum-mode-line-position 1)
(length mode-line))) (length mode-line)))
(push (pop mode-line) res)) (push (pop mode-line) res))
(unless (equal (car mode-line) winum--mode-line-segment) (unless (equal (car mode-line) '(:eval (winum-get-number-string)))
(push winum--mode-line-segment res)) (push '(:eval (winum-get-number-string)) res))
(while mode-line (while mode-line
(push (pop mode-line) res)) (push (pop mode-line) res))
(let ((nres (nreverse res))) (setq-default mode-line-format (nreverse res)))
(setq mode-line-format nres)
(setq-default mode-line-format nres)))
(force-mode-line-update t)) (force-mode-line-update t))
(defun winum--clear-mode-line () (defun winum--clear-mode-line ()
"Remove the window number of `winum-mode' from the mode-line." "Remove the window number of `winum-mode' from the mode-line."
(let ((mode-line (default-value 'mode-line-format)) (let ((mode-line (default-value 'mode-line-format))
res) (res))
(while mode-line (while mode-line
(let ((item (pop mode-line))) (let ((item (car mode-line)))
(unless (equal item winum--mode-line-segment) (unless (equal item '(:eval (winum-get-number-string)))
(push item res)))) (push item res)))
(let ((nres (nreverse res))) (pop mode-line))
(setq mode-line-format nres) (setq-default mode-line-format (nreverse res)))
(setq-default mode-line-format nres)))
(force-mode-line-update t)) (force-mode-line-update t))
(defun winum--update () (defun winum--update ()
@ -545,10 +524,7 @@ windows, however a higher number can be reserved by the user-defined
(or (not (and (frame-live-p f) (or (not (and (frame-live-p f)
(frame-visible-p f))) (frame-visible-p f)))
(string= "initial_terminal" (terminal-name f)) (string= "initial_terminal" (terminal-name f))
(member (buffer-name (window-buffer window)) winum-ignored-buffers) (member (buffer-name (window-buffer window)) winum-ignored-buffers))))
(cl-some
(lambda (regex) (string-match regex (buffer-name (window-buffer window))))
winum-ignored-buffers-regexp))))
(defun winum--list-windows-in-frame (&optional f) (defun winum--list-windows-in-frame (&optional f)
"List windows in frame F using natural Emacs ordering." "List windows in frame F using natural Emacs ordering."