From c109acd6fd66e66691800932aa87b3dd2fb6de64 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 20 Oct 2019 09:26:55 -0400 Subject: [PATCH] Optimize doom-visible-buffers Walking the window list is almost always faster than walking the buffer list. --- core/autoload/buffers.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/autoload/buffers.el b/core/autoload/buffers.el index 1370008ea..f393a570d 100644 --- a/core/autoload/buffers.el +++ b/core/autoload/buffers.el @@ -177,9 +177,9 @@ If DERIVED-P, test with `derived-mode-p', otherwise use `eq'." ;;;###autoload (defun doom-visible-buffers (&optional buffer-list) "Return a list of visible buffers (i.e. not buried)." - (cl-loop for buf in (or buffer-list (doom-buffer-list)) - when (get-buffer-window buf) - collect buf)) + (if buffer-list + (cl-remove-if-not #'get-buffer-window buffer-list) + (delete-dups (mapcar #'window-buffer (window-list))))) ;;;###autoload (defun doom-buried-buffers (&optional buffer-list)