Skip to content

Commit

Permalink
fix: Refresh result for buffer groups and fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Jun 21, 2024
1 parent 7593632 commit 4a121a1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions centaur-tabs-functions.el
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,10 @@ visiting a file. The current buffer is always included."

(defvar centaur-tabs--buffers nil)

(defun centaur-tabs-buffer-groups-result ()
"Return the first group the current buffer belongs to."
(car (nth 2 (assq (current-buffer) centaur-tabs--buffers))))

(defun centaur-tabs-buffer-update-groups ()
"Update tabsets from groups of existing buffers.
Return the the first group where the current buffer is."
Expand Down Expand Up @@ -1089,10 +1093,11 @@ Return the the first group where the current buffer is."

(defun centaur-tabs-buffer-update-groups-cache ()
"Don't call function `centaur-tabs-buffer-update-groups' too often."
(unless centaur-tabs--buffers
(centaur-tabs-buffer-update-groups))
;; Return the first group the current buffer belongs to.
(car (nth 2 (assq (current-buffer) centaur-tabs--buffers))))
(let ((result (centaur-tabs-buffer-groups-result)))
(when (or (null result)
(null centaur-tabs--buffers))
(centaur-tabs-buffer-update-groups))
(centaur-tabs-buffer-groups-result)))

;;
;;; Tab bar callbacks
Expand Down

0 comments on commit 4a121a1

Please sign in to comment.