From dbe7172c1eeeddc4e2d6f3f270f24319d067804c Mon Sep 17 00:00:00 2001 From: tastytea Date: Thu, 11 Jul 2019 01:42:59 +0200 Subject: [PATCH] Enhanced buffer-skipping. --- init.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/init.el b/init.el index 7f6f7fb..93d7714 100644 --- a/init.el +++ b/init.el @@ -1,5 +1,5 @@ ;;; init.el --- tastytea's Emacs init file. -;; Time-stamp: <2019-07-10T21:54:59+00:00> +;; Time-stamp: <2019-07-10T23:41:20+00:00> ;;; Commentary: ;; I am using this file with Emacs 26, but most of it will probably work with @@ -131,12 +131,19 @@ (savehist-mode t) ; Save minibuffer history. (global-auto-revert-mode t) ; Auto-revert file if changed on disk. - (defvar my/skippable-buffers '("^*Messages*" "^*Help*" "^*tramp" "^*Flycheck" - "^magit[:-]" "^*Compile" "^*package") + (defvar my/skippable-buffers '("^\\*" "^magit[:-]") "Buffer names ignored by `next-buffer' and `previous-buffer'.") + (defvar my/never-skippable-buffers '("^\\*scratch\\*$") + "Buffer names never ignored by `next-buffer' and `previous-buffer'.") (defun my/buffer-predicate (buffer) "Returns nil if `buffer'-name matches expression in `my/skippable-buffers'." (catch 'my-catch + ;; Return t if buffer-name is on never-skippable list. + (dolist (expression my/never-skippable-buffers) + (if (string-match expression (buffer-name buffer)) + (throw 'my-catch t) + )) + ;; Return nil if buffer-name is on skippable list. (dolist (expression my/skippable-buffers) (if (string-match expression (buffer-name buffer)) (throw 'my-catch nil)