From 24604d5495db14cc20bfef0bde0a8bd1c15397e5 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 6 Mar 2017 19:07:41 -0500 Subject: [PATCH] Made doom-real-buffer-p flexible w/ doom-real-buffer-functions --- core/autoload/buffers.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/autoload/buffers.el b/core/autoload/buffers.el index 55502c565..064d5a249 100644 --- a/core/autoload/buffers.el +++ b/core/autoload/buffers.el @@ -3,6 +3,10 @@ (defvar-local doom-buffer--narrowed-origin nil) +;;;###autoload +(defvar doom-real-buffer-functions '() + "A list of functions that are run to determine if a buffer is real.") + ;;;###autoload (defvar doom-fallback-buffer "*scratch*" "The name of the buffer to fall back to if no other buffers exist (will create @@ -120,9 +124,10 @@ buffers. If there's nothing left, switch to `doom-fallback-buffer'. See (defun doom-real-buffer-p (&optional buffer-or-name) "Returns t if BUFFER-OR-NAME is a 'real' buffer. Real means it a) isn't a popup window/buffer and b) isn't a special buffer." - (when-let (buffer (ignore-errors (window-normalize-buffer buffer-or-name))) - (not (or (doom-popup-p buffer) - (string-match-p "^ ?\\*" (buffer-name buffer)))))) + (let ((buf (window-normalize-buffer buffer-or-name))) + (or (run-hook-with-args-until-success 'doom-real-buffer-functions buf) + (not (or (doom-popup-p buf) + (string-match-p "^\\s-*\\*" (buffer-name buf))))))) ;;;###autoload (defun doom/next-buffer ()