Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during redisplay: (eval (centaur-tabs-line)) signaled (wrong-type-argument stringp nil) [84 times] #227

Open
avdv opened this issue Jan 5, 2024 · 6 comments

Comments

@avdv
Copy link

avdv commented Jan 5, 2024

Hi.

I am using GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.18.0) and installed centaur-tabs 20230607.1501 from elpa.

The message buffer is spammed with those messages on every key stroke and the tab bar is not shown.

Debugger entered--entering a function:
* substitute-command-keys("Wrong type argument")
* propertize(nil centaur-tabs-tab (#<buffer centaur-tabs-functions.el> . \.emacs.d) pointer hand local-map (keymap (tab-line keymap (mouse-2 . centaur-tabs-do-close) (mouse-1 . centaur-tabs-do-select))))
* centaur-tabs-line-tab((#<buffer centaur-tabs-functions.el> . \.emacs.d))
* (cons (centaur-tabs-line-tab (car tabs)) elts)
* (setq elts (cons (centaur-tabs-line-tab (car tabs)) elts))
* (progn (setq elts (cons (centaur-tabs-line-tab (car tabs)) elts)) (setq atsel (eq (car tabs) sel)) (setq tabs (cdr tabs)))
* (while (and tabs (not atsel)) (progn (setq elts (cons (centaur-tabs-line-tab (car tabs)) elts)) (setq atsel (eq (car tabs) sel)) (setq tabs (cdr tabs))))
* (progn (while (not (memq sel tabs)) (centaur-tabs-scroll tabset -1) (setq tabs (centaur-tabs-view tabset))) (while (and tabs (not atsel)) (progn (setq elts (cons (centaur-tabs-line-tab (car tabs)) elts)) (setq atsel (eq (car tabs) sel)) (setq tabs (cdr tabs)))) (setq elts (nreverse elts)) (let (buffer-list-update-hook) (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (let (... ... deactivate-mark start) (progn ... ...) (setq start ...) (while ... ... ...))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) (setq elts (nreverse elts)) (setq centaur-tabs--track-selected nil))
* (if centaur-tabs--track-selected (progn (while (not (memq sel tabs)) (centaur-tabs-scroll tabset -1) (setq tabs (centaur-tabs-view tabset))) (while (and tabs (not atsel)) (progn (setq elts (cons (centaur-tabs-line-tab (car tabs)) elts)) (setq atsel (eq (car tabs) sel)) (setq tabs (cdr tabs)))) (setq elts (nreverse elts)) (let (buffer-list-update-hook) (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (let ... ... ... ...)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) (setq elts (nreverse elts)) (setq centaur-tabs--track-selected nil)))
* (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) (if centaur-tabs--track-selected (progn (while (not (memq sel tabs)) (centaur-tabs-scroll tabset -1) (setq tabs (centaur-tabs-view tabset))) (while (and tabs (not atsel)) (progn (setq elts (cons (centaur-tabs-line-tab ...) elts)) (setq atsel (eq (car tabs) sel)) (setq tabs (cdr tabs)))) (setq elts (nreverse elts)) (let (buffer-list-update-hook) (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ...) (and ... ...))))) (setq elts (nreverse elts)) (setq centaur-tabs--track-selected nil))) (while tabs (progn (setq elts (cons (centaur-tabs-line-tab (car tabs)) elts)) (setq tabs (cdr tabs)))) (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))))
* (closure (helm-source-centaur-tabs-group t) (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 ... all-tabs)) 1)) atsel elts) (if centaur-tabs--track-selected (progn (while (not (memq sel tabs)) (centaur-tabs-scroll tabset -1) (setq tabs (centaur-tabs-view tabset))) (while (and tabs (not atsel)) (progn (setq elts ...) (setq atsel ...) (setq tabs ...))) (setq elts (nreverse elts)) (let (buffer-list-update-hook) (let (...) (save-current-buffer ... ...))) (setq elts (nreverse elts)) (setq centaur-tabs--track-selected nil))) (while tabs (progn (setq elts (cons (centaur-tabs-line-tab ...) elts)) (setq tabs (cdr tabs)))) (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)))))(\.emacs.d)
* apply((closure (helm-source-centaur-tabs-group t) (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 ... all-tabs)) 1)) atsel elts) (if centaur-tabs--track-selected (progn (while (not (memq sel tabs)) (centaur-tabs-scroll tabset -1) (setq tabs (centaur-tabs-view tabset))) (while (and tabs (not atsel)) (progn (setq elts ...) (setq atsel ...) (setq tabs ...))) (setq elts (nreverse elts)) (let (buffer-list-update-hook) (let (...) (save-current-buffer ... ...))) (setq elts (nreverse elts)) (setq centaur-tabs--track-selected nil))) (while tabs (progn (setq elts (cons (centaur-tabs-line-tab ...) elts)) (setq tabs (cdr tabs)))) (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))))) \.emacs.d)
* centaur-tabs-line-format(\.emacs.d)

Seems like the centaur-tabs-active-bar is nil?

@realark
Copy link
Contributor

realark commented Jun 17, 2024

I'm seeing this too. Seems to happen when buffers that don't have a tabset are opened (for example, org-agenda). Adding a simple null check to centaur-tabs-make-tabset resolves the problem, but I'm not sure if this is the desired solution:

(defun centaur-tabs-make-tabset (name &rest objects)
  "Make a new tab set whose name is the string NAME.
It is initialized with tabs build from the list of OBJECTS."
  (when name
    (let* ((tabset (intern name centaur-tabs-tabsets))
           (tabs (mapcar #'(lambda (object)
                             (centaur-tabs-make-tab object tabset))
                         objects)))
      (set tabset tabs)
      (centaur-tabs-put-cache tabset 'select (car tabs))
      (put tabset 'start 0)
      tabset)))

realark added a commit to realark/centaur-tabs that referenced this issue Jun 17, 2024
Squashes ema2159#227

I'm not sure if this is the best fix (I'm just solving the immediate
problem). Input is appreciated.
@avdv
Copy link
Author

avdv commented Jun 21, 2024

Unfortunately, #235 does not fix it for me, I still see these errors in the message buffer (and it's slowing Emacs down).

@jcs090218
Copy link
Collaborator

Does the error exist in only Emacs 30? 🤔 Can you tell me how to reproduce this error? Thanks!

@jcs090218 jcs090218 reopened this Jun 22, 2024
@avdv
Copy link
Author

avdv commented Jun 24, 2024

Does the error exist in only Emacs 30? 🤔

In the meantime, I switched back to Emacs 29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0) hoping that it would fix the error.

Can you tell me how to reproduce this error? Thanks!

It fails in centaur-tabs-line-format and later in centaur-tabs-line-tab, here's a backtrace:

Debugger entered--entering a function:
* substitute-command-keys("Wrong type argument")
* propertize(nil centaur-tabs-tab (#<buffer centaur-tabs-functions.el> . \.emacs.d) pointer hand local-map (keymap (tab-line keymap (mouse-2 . centaur-tabs-do-close) (mouse-1 . centaur-tabs-do-select))))
* centaur-tabs-line-tab((#<buffer centaur-tabs-functions.el> . \.emacs.d))
    [no locals]
* (cons (centaur-tabs-line-tab (car tabs)) elts)
* (setq elts (cons (centaur-tabs-line-tab (car tabs)) elts))
* (progn (setq elts (cons (centaur-tabs-line-tab (car tabs)) elts)) (setq tabs (cdr tabs)))
* (while tabs (progn (setq elts (cons (centaur-tabs-line-tab (car tabs)) elts)) (setq tabs (cdr tabs))))
* (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) (mapcar 'car all-tabs)) 1)) atsel elts) (if nil (progn (while (not (memq sel tabs)) (centaur-tabs-scroll tabset -1) (setq tabs (centaur-tabs-view tabset))) (while (and tabs (not atsel)) (progn (setq elts (cons (centaur-tabs-line-tab ...) elts)) (setq atsel (eq (car tabs) sel)) (setq tabs (cdr tabs)))) (setq elts (nreverse elts)) (let (buffer-list-update-hook) (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ...) (and ... ...))))) (setq elts (nreverse elts)) (setq centaur-tabs--track-selected nil))) (while tabs (progn (setq elts (cons (centaur-tabs-line-tab (car tabs)) elts)) (setq tabs (cdr tabs)))) (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))))
* (closure (t) (tabset) "Return the `centaur-tabs-display-line-format' valu..." (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) (mapcar ... all-tabs)) 1)) atsel elts) (if nil (progn (while (not (memq sel tabs)) (centaur-tabs-scroll tabset -1) (setq tabs (centaur-tabs-view tabset))) (while (and tabs (not atsel)) (progn (setq elts ...) (setq atsel ...) (setq tabs ...))) (setq elts (nreverse elts)) (let (buffer-list-update-hook) (let (...) (save-current-buffer ... ...))) (setq elts (nreverse elts)) (setq centaur-tabs--track-selected nil))) (while tabs (progn (setq elts (cons (centaur-tabs-line-tab ...) elts)) (setq tabs (cdr tabs)))) (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)))))(\.emacs.d)
* apply((closure (t) (tabset) "Return the `centaur-tabs-display-line-format' valu..." (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) (mapcar ... all-tabs)) 1)) atsel elts) (if nil (progn (while (not (memq sel tabs)) (centaur-tabs-scroll tabset -1) (setq tabs (centaur-tabs-view tabset))) (while (and tabs (not atsel)) (progn (setq elts ...) (setq atsel ...) (setq tabs ...))) (setq elts (nreverse elts)) (let (buffer-list-update-hook) (let (...) (save-current-buffer ... ...))) (setq elts (nreverse elts)) (setq centaur-tabs--track-selected nil))) (while tabs (progn (setq elts (cons (centaur-tabs-line-tab ...) elts)) (setq tabs (cdr tabs)))) (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))))) \.emacs.d)
* centaur-tabs-line-format(\.emacs.d)
  (progn (centaur-tabs-line-format centaur-tabs-current-tabset))

It seems like centaur-tabs-active-bar is nil. (Oh, I just discovered this in my initial report too. 🤦)

\edit: After evaluating the (defvar centaur-tabs-active-bar ...) in centaur-tabs-elements.el the error is gone, and the tabs are displayed.

Is this some sort of initialization problem then? I am using spacemacs.

@avdv
Copy link
Author

avdv commented Jul 9, 2024

Oh, that may be related to #127 since I am running Emacs as a service / daemon, too. So centaur-tabs-active-bar being nil is probably just because centaur-tabs--make-xpm indeed returned nil...

When starting Emacs directly the tabs seem to work just fine.

@amosbird
Copy link

The issue can be reproduced when checking out a different branch with a different set of project files using Git, causing (centaur-tabs-selected-tab tabset) to return nil.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants