[imp] allow ignoring buffers with regex

This commit is contained in:
mpanarin 2019-07-30 11:57:24 +03:00
parent 247df36c03
commit 23d1ecce94
2 changed files with 16 additions and 1 deletions

View file

@ -268,6 +268,12 @@ Several options are available through Emacs' Customize interface under
Default: '(" *which-key*") Default: '(" *which-key*")
- =winum-ignored-buffers-regex=
List of regexes. Matching buffers will be ignored when assigning numbers.
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.

View file

@ -155,6 +155,12 @@ result of `winum-get-number-string'."
:group 'winum :group 'winum
:type '(repeat string)) :type '(repeat string))
(defcustom winum-ignored-buffers-regex '()
"List of regex for buffers to ignore when assigning numbers."
: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)
@ -538,7 +544,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-regex))))
(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."