Closed erikmd closed 3 months ago
Hi @ema2159 ! would you have a clue of how to fix this bug?
FWIW, the centaur-tabs-line-format code is as follows:
(defun centaur-tabs-line-format (tabset)
"Return the `centaur-tabs-display-line-format' value to display TABSET."
(let* ((sel (centaur-tabs-selected-tab tabset))
(tabs (centaur-tabs-view tabset))
(padcolor centaur-tabs-background-color)
(all-tabs (centaur-tabs-tabs tabset))
(total-tabs (length all-tabs))
(sel-index (+ (cl-position (car sel) (cl-mapcar 'car all-tabs)) 1))
atsel elts)
;; Track the selected tab to ensure it is always visible.
(when centaur-tabs--track-selected
(while (not (memq sel tabs))
(centaur-tabs-scroll tabset -1)
(setq tabs (centaur-tabs-view tabset)))
(while (and tabs (not atsel))
(setq elts (cons (centaur-tabs-line-tab (car tabs)) elts)
atsel (eq (car tabs) sel)
tabs (cdr tabs)))
(setq elts (nreverse elts))
;; At this point the selected tab is the last elt in ELTS.
;; Scroll TABSET and ELTS until the selected tab becomes
;; visible.
(let (buffer-list-update-hook)
(with-temp-buffer
(let ((truncate-partial-width-windows nil)
(inhibit-modification-hooks t)
deactivate-mark ;; Prevent deactivation of the mark!
start)
(setq truncate-lines nil
buffer-undo-list t)
(setq start (point))
(while (and (cdr elts) ;; Always show the selected tab!
(progn
(delete-region start (point-max))
(goto-char (point-max))
(apply #'insert elts)
(goto-char (point-min))
(> (vertical-motion 1) 0)))
(centaur-tabs-scroll tabset 1)
(setq elts (cdr elts))))))
(setq elts (nreverse elts))
(setq centaur-tabs--track-selected nil))
;; Format remaining tabs.
(while tabs
(setq elts (cons (centaur-tabs-line-tab (car tabs)) elts)
tabs (cdr tabs)))
;; Cache and return the new tab bar.
(centaur-tabs-set-template
tabset
(list
(centaur-tabs-count sel-index total-tabs)
(centaur-tabs-line-format--buttons)
(nreverse elts)
(propertize "% "
'face (list :background padcolor)
'pointer 'arrow)
(centaur-tabs-line-format--new-button)))
))
and the (1st) error comes from the evaluation of (+ (cl-position (car sel) (cl-mapcar 'car all-tabs)) 1)
given sel = nil
Hi @ema2159 ! - just a friendly ping ^^
FYI I can't reproduce the issue anymore (@jcs090218 I believe you fixed it along the way) so closing the issue now, thanks!
Dear @ema2159, I recently spotted a subtle bug that I wasn't able to fix myself. See the details below. I use GNU Emacs 27.1 on Debian 11.
Steps to reproduce