Compare commits
10 commits
d7b7eecf08
...
c5455e866e
Author | SHA1 | Date | |
---|---|---|---|
c5455e866e | |||
098249c650 | |||
e571c320f1 | |||
23d1ecce94 | |||
247df36c03 | |||
efcb14fd30 | |||
b27b8f4db7 | |||
8bafa66f80 | |||
a096da2881 | |||
6f0c451799 |
63
README.org
63
README.org
|
@ -3,17 +3,20 @@
|
||||||
[[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]]
|
||||||
- [[#whats-changed-since-window-numbering][What's changed since window-numbering]]
|
- [[#changelog][Changelog]]
|
||||||
- [[#installation][Installation]]
|
- [[#sep-11-2019][Sep. 11 2019]]
|
||||||
- [[#using-melpa][Using Melpa]]
|
- [[#nov-15-2018][Nov. 15 2018]]
|
||||||
- [[#manual-installation][Manual installation]]
|
- [[#initial-release-whats-changed-since-window-numbering][Initial release: what's changed since window-numbering]]
|
||||||
- [[#how-to-use][How to use]]
|
- [[#installation][Installation]]
|
||||||
- [[#configuration][Configuration]]
|
- [[#using-melpa][Using Melpa]]
|
||||||
- [[#keybindings][Keybindings]]
|
- [[#manual-installation][Manual installation]]
|
||||||
- [[#customize-options][Customize options]]
|
- [[#how-to-use][How to use]]
|
||||||
- [[#configuration-file-example][Configuration file example]]
|
- [[#configuration][Configuration]]
|
||||||
- [[#future-developments][Future developments]]
|
- [[#keybindings][Keybindings]]
|
||||||
|
- [[#customize-options][Customize options]]
|
||||||
|
- [[#configuration-file-example][Configuration file example]]
|
||||||
|
- [[#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 !
|
||||||
|
@ -25,7 +28,15 @@ 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
|
||||||
|
** 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
|
||||||
|
@ -224,7 +235,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-and ()
|
(defun winum-assign-0-to-neotree ()
|
||||||
(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)
|
||||||
|
@ -241,6 +252,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.
|
||||||
|
@ -253,6 +272,13 @@ 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.
|
||||||
|
@ -284,7 +310,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-and ()
|
(defun winum-assign-0-to-neotree ()
|
||||||
(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)
|
||||||
|
@ -297,8 +323,10 @@ 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
|
||||||
|
@ -321,9 +349,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:
|
||||||
|
|
46
winum.el
46
winum.el
|
@ -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.0.0
|
;; Version: 2.2.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,11 +143,25 @@ 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)
|
||||||
|
@ -208,6 +222,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.")
|
||||||
|
@ -412,23 +430,26 @@ 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) '(:eval (winum-get-number-string)))
|
(unless (equal (car mode-line) winum--mode-line-segment)
|
||||||
(push '(:eval (winum-get-number-string)) res))
|
(push winum--mode-line-segment res))
|
||||||
(while mode-line
|
(while mode-line
|
||||||
(push (pop mode-line) res))
|
(push (pop mode-line) res))
|
||||||
(setq-default mode-line-format (nreverse res)))
|
(let ((nres (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 (car mode-line)))
|
(let ((item (pop mode-line)))
|
||||||
(unless (equal item '(:eval (winum-get-number-string)))
|
(unless (equal item winum--mode-line-segment)
|
||||||
(push item res)))
|
(push item res))))
|
||||||
(pop mode-line))
|
(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--update ()
|
(defun winum--update ()
|
||||||
|
@ -524,7 +545,10 @@ 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."
|
||||||
|
|
Loading…
Reference in a new issue