ema2159 / centaur-tabs

Emacs plugin aiming to become an aesthetic, modern looking tabs plugin
GNU General Public License v3.0
727 stars 50 forks source link

Error during redisplay: (eval (centaur-tabs-line)) signaled (wrong-type-argument stringp vc) #191

Closed e190 closed 1 year ago

e190 commented 1 year ago

GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.17.6) of 2022-04-13 GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.23, cairo version 1.13.1) of 2022-09-21

I get errors when I open C files, but I don't get errors when I open Lisp files, such as init.el . Error during redisplay: (eval (centaur-tabs-line)) signaled (wrong-type-argument stringp vc) [198 times]

zbelial commented 1 year ago

I have the same problem. You can modify centaur-tabs-project-name to work around this problem.

(defun centaur-tabs-project-name ()
  "Get project name for tabs."
  (let ((project-name (cdr (project-current))))
    (if project-name
    (format "Project: %s" (expand-file-name project-name))
      centaur-tabs-common-group-name)))
zbelial commented 1 year ago

As I said in #192 , it seems in Emacs 29, project-current returns something with different format.

ema2159 commented 1 year ago

Yes. I tried to solve it in a way that backward compatibility was not compromised, but apparently, it didn't work. Can you please show me what is displayed when you evaluate (project-current) in the problematic buffers? You can do M-: (message "%s" (project-current)).

e190 commented 1 year ago

The results of (project-current) are not problematic.

Error during redisplay: (eval (centaur-tabs-line)) signaled (wrong-type-argument stringp vc) [29 times]
(vc . ~/work/l508-test/)
"(vc . ~/work/l508-test/)"Error during redisplay: (eval (centaur-tabs-line)) signaled (wrong-type-argument stringp vc)
Error during redisplay: (eval (centaur-tabs-line)) signaled (wrong-type-argument stringp vc) [93 times]
ema2159 commented 1 year ago

Hmmm, I wonder what is it then, because that was the only change. Could you go to the problematic buffer, do this: M-: (message "%s" (project-current)), and post here what is printed in the minibuffer please?

zbelial commented 1 year ago

In Emacs 28, (message "%s" (project-current)) will return something like (vc . ~/work/l508-test/), which I get from e190's reply.

You can see that it's not a proper list. But in Emacs 29, the result is a proper list. So maybe the function centaur-tabs-project-name can be modified in the following way?

          (defun centaur-tabs-project-name ()
              "Get project name for tabs."
              (let* ((project-current (project-current))
                     (project-name (if (proper-list-p project-current)
                                       (car (last project-current))
                                     (cdr project-current))))
                (if project-name
                (format "Project: %s" (expand-file-name project-name))
                  centaur-tabs-common-group-name)))

It works for me in Emacs 28. WDYT?

ema2159 commented 1 year ago

@zbelial thanks a lot! The issue is that in Emacs versions below 29, (project-current) returns a cons cell, whereas in more recent versions, a list is returned instead. With the workaround you proposed it should now work just fine.