Compare commits

..

10 commits

Author SHA1 Message Date
deb0ch c5455e866e update changelog 2019-09-11 18:11:12 +02:00
deb0ch 098249c650 bump version to 2.2.0 2019-09-11 18:07:17 +02:00
deb0ch e571c320f1 improve docs for winum-ignored-buffers-regexp 2019-09-11 18:07:17 +02:00
mpanarin 23d1ecce94 [imp] allow ignoring buffers with regex 2019-07-30 12:02:12 +03:00
deb0ch 247df36c03 fix typo in README
fixes #19
2019-02-18 10:37:01 +01:00
deb0ch efcb14fd30 bump version to 2.1.0 2018-11-19 18:05:40 +01:00
deb0ch b27b8f4db7 add custom variable winum-format 2018-11-19 18:05:09 +01:00
Thomas de Beauchêne 8bafa66f80 minor code improvement 2018-11-07 01:47:11 +01:00
Thomas de Beauchêne a096da2881 fix bug mode-line not reset after multiple invocations
Fix a bug where the mode-line would not get rid of or regain the winum segment
after winum-mode being activated several times non-interactively and then
deactivated.
2018-11-07 01:44:48 +01:00
Thomas de Beauchêne 6f0c451799 put mode-line segment into a variable 2018-11-07 01:40:30 +01:00
2 changed files with 78 additions and 31 deletions

View file

@ -4,7 +4,10 @@
* Contents :TOC:noexport:
- [[#introduction][Introduction]]
- [[#whats-changed-since-window-numbering][What's changed since window-numbering]]
- [[#changelog][Changelog]]
- [[#sep-11-2019][Sep. 11 2019]]
- [[#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]]
- [[#manual-installation][Manual installation]]
@ -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
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:
- 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) "*Flycheck errors*") 8)))
(defun winum-assign-0-to-neotree-and ()
(defun winum-assign-0-to-neotree ()
(when (string-match-p (buffer-name) ".*\\*NeoTree\\*.*") 10))
(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=
- =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=
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*")
- =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 used for the number in the mode-line.
@ -284,7 +310,7 @@ available winum options.
((equal (buffer-name) "*Calculator*") 9)
((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))
(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-assign-func 'my-winum-assign-func
winum-auto-setup-mode-line t
winum-format " %s "
winum-mode-line-position 1
winum-ignored-buffers '(" *which-key*"))
winum-ignored-buffers '(" *which-key*")
winum-ignored-buffers-regexp '(" \\*Treemacs-.*"))
(winum-mode)
#+END_SRC
@ -321,9 +349,4 @@ available winum options.
- 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:

View file

@ -17,7 +17,7 @@
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;
;; Author: Thomas de Beauchêne <thomas.de.beauchene@gmail.com>
;; Version: 2.0.0
;; Version: 2.2.0
;; Keywords: convenience, frames, windows, multi-screen
;; URL: http://github.com/deb0ch/winum.el
;; Created: 2016
@ -143,11 +143,25 @@ numbers in the mode-line."
:group 'winum
: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*")
"List of buffers to ignore when assigning numbers."
:group 'winum
: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 '()
"Face used for the number in the mode-line."
: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.")
(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
"Tracks the last used `winum-scope'.
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)
(length mode-line)))
(push (pop mode-line) res))
(unless (equal (car mode-line) '(:eval (winum-get-number-string)))
(push '(:eval (winum-get-number-string)) res))
(unless (equal (car mode-line) winum--mode-line-segment)
(push winum--mode-line-segment res))
(while mode-line
(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))
(defun winum--clear-mode-line ()
"Remove the window number of `winum-mode' from the mode-line."
(let ((mode-line (default-value 'mode-line-format))
(res))
res)
(while mode-line
(let ((item (car mode-line)))
(unless (equal item '(:eval (winum-get-number-string)))
(push item res)))
(pop mode-line))
(setq-default mode-line-format (nreverse res)))
(let ((item (pop mode-line)))
(unless (equal item winum--mode-line-segment)
(push item res))))
(let ((nres (nreverse res)))
(setq mode-line-format nres)
(setq-default mode-line-format nres)))
(force-mode-line-update t))
(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)
(frame-visible-p 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)
"List windows in frame F using natural Emacs ordering."