From 23d1ecce94963ed920147ed644d7122fb7d7f015 Mon Sep 17 00:00:00 2001 From: mpanarin Date: Tue, 30 Jul 2019 11:57:24 +0300 Subject: [PATCH] [imp] allow ignoring buffers with regex --- README.org | 6 ++++++ winum.el | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.org b/README.org index 6fd124d..d242568 100644 --- a/README.org +++ b/README.org @@ -268,6 +268,12 @@ Several options are available through Emacs' Customize interface under Default: '(" *which-key*") +- =winum-ignored-buffers-regex= + + List of regexes. Matching buffers will be ignored when assigning numbers. + + Default: '() + - face: =winum-face= Face used for the number in the mode-line. diff --git a/winum.el b/winum.el index 5eaa567..40839ff 100644 --- a/winum.el +++ b/winum.el @@ -155,6 +155,12 @@ result of `winum-get-number-string'." :group 'winum :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 '() "Face used for the number in the mode-line." :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) (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-regex)))) (defun winum--list-windows-in-frame (&optional f) "List windows in frame F using natural Emacs ordering."