Enhanced buffer-skipping.

This commit is contained in:
tastytea 2019-07-11 01:42:59 +02:00
parent f4dddb621a
commit dbe7172c1e
1 changed files with 10 additions and 3 deletions

13
init.el
View File

@ -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)